mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
outgoing_webhook: Ignore the exception on failure if the stream is gone.
In the outgoing webhook handler, there is potentially several seconds of trying between when a message triggering an outgoing webhook arrives, and when it fails. In the meantime, the stream the triggering message was on may have been deleted, causing the "Failure!" message to have no valid stream to be sent to. Rather than raise an exception in the outgoing webhook worker, ignore the exception and move on.
This commit is contained in:
committed by
Tim Abbott
parent
eb7a2f2c38
commit
d8ebbedbbb
@@ -11,7 +11,7 @@ from requests import Response
|
||||
|
||||
from version import ZULIP_VERSION
|
||||
from zerver.actions.message_send import check_send_message
|
||||
from zerver.lib.exceptions import JsonableError
|
||||
from zerver.lib.exceptions import JsonableError, StreamDoesNotExistError
|
||||
from zerver.lib.message import MessageDict
|
||||
from zerver.lib.outgoing_http import OutgoingSession
|
||||
from zerver.lib.queue import retry_event
|
||||
@@ -232,7 +232,12 @@ def fail_with_message(event: Dict[str, Any], failure_message: str) -> None:
|
||||
message_info = event["message"]
|
||||
content = "Failure! " + failure_message
|
||||
response_data = dict(content=content)
|
||||
send_response_message(bot_id=bot_id, message_info=message_info, response_data=response_data)
|
||||
try:
|
||||
send_response_message(bot_id=bot_id, message_info=message_info, response_data=response_data)
|
||||
except StreamDoesNotExistError:
|
||||
# If the stream has vanished while we were failing, there's no
|
||||
# reasonable place to report the error.
|
||||
pass
|
||||
|
||||
|
||||
def get_message_url(event: Dict[str, Any]) -> str:
|
||||
|
||||
Reference in New Issue
Block a user