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

Fix #1325 by handling the exception #1335

Merged
merged 2 commits into from
Dec 9, 2024
Merged

Fix #1325 by handling the exception #1335

merged 2 commits into from
Dec 9, 2024

Conversation

reidsunderland
Copy link
Member

@reidsunderland reidsunderland commented Dec 9, 2024

Current behaviour stays the same:

  • if putNewMessage returns False, failed message and all remaining messages* in the worklist are put into worklist.failed

New behaviour:

  • if putNewMessage crashes the exception is handled. The current message and all remaining messages* are put into worklist.failed

* the remaining messages will not attempt to be posted

Any messages that were successfully posted will be put into worklist.ok

Copy link

github-actions bot commented Dec 9, 2024

Test Results

238 tests   235 ✅  1m 31s ⏱️
  1 suites    1 💤
  1 files      2 ❌

For more details on these failures, see this check.

Results for commit b6011b5.

@reidsunderland reidsunderland marked this pull request as ready for review December 9, 2024 16:39
@reidsunderland
Copy link
Member Author

reidsunderland commented Dec 9, 2024

If I add an obvious error to putNewMessage to force it to crash, this is the result:

2024-12-09 16:37:59,835 [ERROR] sarracenia.flowcb.post.message post failed: name 'y' is not defined
2024-12-09 16:37:59,835 [DEBUG] sarracenia.flowcb.post.message post Exception details:
Traceback (most recent call last):
  File "/local/home/sarra/sr3/sarracenia/flowcb/post/message.py", line 41, in post
    if all_good and hasattr(self.poster,'putNewMessage') and self.poster.putNewMessage(m):
  File "/local/home/sarra/sr3/sarracenia/moth/amqp.py", line 641, in putNewMessage
    x = y
NameError: name 'y' is not defined

The log plugin does not incorrectly state that the message was posted.

And the messages are going into the post retry disk queue:

2024-12-09 16:37:59,996 [DEBUG] sarracenia.flowcb.retry after_work loading from post_retry_014: qty=12 ... got: 0
...
2024-12-09 16:38:59,502 [DEBUG] sarracenia.flowcb.retry on_housekeeping on_housekeeping
2024-12-09 16:38:59,600 [DEBUG] sarracenia.flowcb.retry after_work loading from post_retry_014: qty=12 ... got: 12
2024-12-09 16:38:59,604 [DEBUG] sarracenia.flowcb.retry on_housekeeping on_housekeeping

** I changed "failed:" to "crashed:" after this test, because we usually use the word crashed when a method threw an exception. Failed makes more sense in the case where putNewMessage returns False.

@petersilva petersilva merged commit 32eee1b into development Dec 9, 2024
0 of 4 checks passed
@reidsunderland reidsunderland deleted the issue1325 branch December 18, 2024 20:52
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

Successfully merging this pull request may close these issues.

2 participants