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

catch failed watch callbacks #19

Open
sanoel opened this issue Apr 3, 2020 · 2 comments
Open

catch failed watch callbacks #19

sanoel opened this issue Apr 3, 2020 · 2 comments

Comments

@sanoel
Copy link
Contributor

sanoel commented Apr 3, 2020

If the watch handler fails, e.g., writes made when syncing with a remote server, we should not commit the change and should retry the callback with an exponential backoff. Implement try/catch around the watch callback, and if caught, print an error message and revert the _rev in the cache.

@tomohiroarakawa
Copy link
Member

I like the idea of reverting the cache when the callback throws an exception. I feel that the retry with an exponential backoff should be implemented by the callback but not by oada-cache. There may be a case where we don't want to retry, or we want to retry but with a different backoff parameter, etc...

@aultac
Copy link
Member

aultac commented Apr 5, 2020

@tomohiroarakawa if we revert the cache’s rev for the resource, we’ll have to do something to re-emit the change again so the cache can try to catch up. It would make sense for it to re-emit on an exponential backoff. It also would make sense for you to be able to throw something that says to the cache “don’t revert, just forget this change”. I also think it should be an option for the entire watch: i.e. “for this entire watch, here is the default behavior for failed callbacks.” We probably should also not emit newer rev’s until we get a successful handling of the oldest rev or we could get out of order changes, but for @sanoel’s purposes now I think it is fine without dealing with that race condition.

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

3 participants