Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

workers: Log the exception if the export fails.

Alex Vandiver127108c7d1eb
diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py
index 3f1b7a5dcdd..35b46991dc5 100644
--- a/zerver/tests/test_events.py
+++ b/zerver/tests/test_events.py
@@ -2314,7 +2314,7 @@ class NormalActionsTest(BaseAction):
self.login_user(self.user_profile)
with mock.patch(
- "zerver.lib.export.do_export_realm", side_effect=Exception("test")
+ "zerver.lib.export.do_export_realm", side_effect=Exception("Some failure")
), self.assertLogs(level="ERROR") as error_log:
with stdout_suppressed():
events = self.verify_action(
@@ -2327,6 +2327,7 @@ class NormalActionsTest(BaseAction):
# Where last floating number is time and will vary in each test hence the following assertion is
# independent of time bit by not matching exact log but only part of it.
self.assertTrue("ERROR:root:Data export for zulip failed after" in error_log.output[0])
+ self.assertTrue("Some failure" in error_log.output[0])
# We get two events for the export.
check_realm_export(
diff --git a/zerver/worker/queue_processors.py b/zerver/worker/queue_processors.py
index 865a6712fdd..6a80ca9c8c3 100644
--- a/zerver/worker/queue_processors.py
+++ b/zerver/worker/queue_processors.py
@@ -1039,10 +1039,11 @@ class DeferredWorker(QueueProcessingWorker):
)
).decode()
export_event.save(update_fields=["extra_data"])
- logging.error(
+ logging.exception(
"Data export for %s failed after %s",
user_profile.realm.string_id,
time.time() - start,
+ stack_info=True,
)
notify_realm_export(user_profile)
return