-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
PubSub: Policy.on_exception
actually used to make consumer go inactive.
#4472
Conversation
bool: ``True`` if this subscription is opened with this future, | ||
``False`` otherwise. | ||
bool: :data:`True` if this subscription is opened with this | ||
future, :data:`False` otherwise. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
policy.on_response.side_effect = exc | ||
|
||
consumer = _consumer.Consumer(policy=policy) | ||
policy.on_exception.side_effect = OnException(consumer._exiting) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -244,10 +244,9 @@ def _blocking_consume(self): | |||
self.stop_consuming() | |||
except Exception as exc: | |||
try: | |||
self._policy.on_exception(exc) | |||
self.active = self._policy.on_exception(exc) | |||
except: | |||
self.active = False |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -244,10 +244,9 @@ def _blocking_consume(self): | |||
self.stop_consuming() | |||
except Exception as exc: | |||
try: | |||
self._policy.on_exception(exc) | |||
self.active = self._policy.on_exception(exc) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
OK I have updated the gist to be much clearer as to how things were behaving and how they behave now. Most notable:
|
This keeps the thread active after one failure but stops after a second.
Remaining point of discussion (got buried below the fold):
|
Policy.on_exception
actually used to make consumer go inactive.Policy.on_exception
actually used to make consumer go inactive.
OK my previous remark seems to be wrong, instead it seems that |
I am going to merge this since it "moves the bar" towards correctness even though I know it isn't 100% correct. E.g. I can still trigger "set_exception can only be called once." by using a subscription that doesn't exist. |
Towards #4463.