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

Most robust way to "finally" processing? #29

Open
abingham opened this issue Nov 14, 2014 · 1 comment
Open

Most robust way to "finally" processing? #29

abingham opened this issue Nov 14, 2014 · 1 comment

Comments

@abingham
Copy link

The documentation warns that sometimes a "finally" block may not be executed due to asynchrony. If I have some clean-up code that needs to be run no matter how a deferred chain terminates, what's the best, most robust way to do that? I worry about implementing cleanup code that silently gets ignored sometimes.

@kiwanami
Copy link
Owner

Hi @abingham

When some deferred task fails to call the callback function without appropriate error handling, the subsequent tasks can not be executed for ever. In this case, the 'finally' block will not be executed.
Not only coding bugs on elisp, but also external processes cause to break deferred flows, such as unexpected freezing, undetectable exiting, packet loss and some I/O error with disk or network.

So, the robust clean up way for asynchronous flow is making the time-out block. Please see the document for the details. https://github.com/kiwanami/emacs-deferred#timeout

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