Repository navigation
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.
| 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.
| 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.