Skip to content
This repository has been archived by the owner on Dec 25, 2019. It is now read-only.

Event processing stops when processQueue throws #21

Closed
NicolaVerbeeck opened this issue Nov 20, 2014 · 4 comments
Closed

Event processing stops when processQueue throws #21

NicolaVerbeeck opened this issue Nov 20, 2014 · 4 comments
Labels

Comments

@NicolaVerbeeck
Copy link

When processQueue throws an exception, the entire event bus stops working (mProcessing remains true)

Suggest adding a try - finnaly block that resets mProcessing

@sergejsha
Copy link
Owner

This was intentional design decision. Bus fails fast to reveal all errors immediately during development. If exception happens, then it must be fixed. Application will typically force close afterwards.

Why would you need to resume and continue? What is your exact use case?

@NicolaVerbeeck
Copy link
Author

I agree that this helps fix application errors by forcing this during development, but when an error like this would occur in a production app, in theory, the app could continue working (if the exception was caught, in which case the app design should have been better, agreed).

I think this is a balance between forcing better flow design and robustness in case of failure. Now that we know runtime errors can be thrown when registering for example, we can check for this (and remove the catch-all from otto shame)

@sergejsha
Copy link
Owner

I believe your request is good. I just wanted to better understand all consequences.

Current implementation starts to simply ignore requests coming after an exception. This is rather hiding issue, then making it obvious, which is bad. A better solution would be either to continue to handle events properly, or to fail on every follow-up request showing that bus state is invalid. As far as Bus does not hide any exceptions and if subscribers caught them, the bus must recover and continue with prop event dispatching. It won't make things better, and would be robust.

sergejsha pushed a commit that referenced this issue Nov 20, 2014
properly if applciation catches and handles possible exceptions.
@sergejsha
Copy link
Owner

Changes have been pushed to the master branch

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

No branches or pull requests

2 participants