1
votes

I've got a web role on Azure that one of its jobs is to upload a picture, format it and then upload to a BLOB.

I do this with a temp directory on the web role - so there is a temp file there which I delete after it is uploaded to a BLOB.

Sometime the uploading is interrupted or the web role has some problems and the temp image file stays on the web role.

I want to create a worker role that once in X hours will clean that folder. It is possible that I will have 100 web roles (each one in its own isolated environment) and only 2 worker roles - So they have to somehow get to the web roles, one by one, and delete those files.

So my question is - Is this even possible?! if so, how?

Thanks!

1

1 Answers

4
votes

Should you create a worker role it would run on a separate VM, not the same as your web role and that would defeat the whole idea since you can't get to another VM without a carefully crafted interface and such interface would definitely be an overkill for this task.

What you really want is just a separate thread (System.Threading.Thread) that you start from within the web role entry point and that continuously monitors the temporary folder for leftover files. That will be cheap and working.