Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how should the AutoRenewLease class notify users of the class when it cannot renew a lease? #3

Open
cbertolasio opened this issue Nov 13, 2011 · 1 comment

Comments

@cbertolasio
Copy link

So, I wanted to say thanks again for the AutoRenewLease class. The concept is really cool, and it's something that I have been trying to work into one of my worker roles.

The AutoRenewLease tries to keep the lease alive by doing the RenewLease in the background. I may have some Task running in my my worker role that when the task starts, it creates an instance of AutoRenewLease, and when my task is done, it destorys auto renew lease.

If my task can ONLY continue working while the lease is alive, what would be a good pattern to follow, such that AutoRenewLease could notify my task if the lease could not be renewed. i.e. my task is in the middle of it's run operation, and the renew fails, and now I need to cancel my task's run bits, and rollback any changes.

Thoughts?

@smarx
Copy link
Owner

smarx commented Nov 13, 2011

Well, the way it works now is that an exception is thrown when the lease can't be renewed. It should be quite exceptional that the lease can't be renewed (means a network error, some sort of timing issue where the thread didn't wake up soon enough, or another process explicitly breaking the lease).

If you want something more interactive, I would suggest not using an AutoRenewLease and just writing code (a loop?) where you renew periodically and just check whether that succeeds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants