Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
soft_deactivate: Log and continue on failure to catch up a user.
Alex Vandiver11177a40dacd
diff --git a/zerver/lib/soft_deactivation.py b/zerver/lib/soft_deactivation.pyindex 0837910ffec..1039d7d2aca 100644--- a/zerver/lib/soft_deactivation.py+++ b/zerver/lib/soft_deactivation.py@@ -7,6 +7,7 @@ from django.conf import settingsfrom django.db import transactionfrom django.db.models import Maxfrom django.utils.timezone import now as timezone_now+from sentry_sdk import capture_exceptionfrom zerver.lib.logging_util import log_to_filefrom zerver.models import (@@ -342,11 +343,18 @@ def do_soft_activate_users(users: List[UserProfile]) -> List[UserProfile]:def do_catch_up_soft_deactivated_users(users: List[UserProfile]) -> List[UserProfile]:users_caught_up = []+ failures = []for user_profile in users:if user_profile.long_term_idle:- add_missing_messages(user_profile)- users_caught_up.append(user_profile)+ try:+ add_missing_messages(user_profile)+ users_caught_up.append(user_profile)+ except Exception: # nocoverage+ capture_exception() # nocoverage+ failures.append(user_profile) # nocoveragelogger.info("Caught up %d soft-deactivated users", len(users_caught_up))+ if failures:+ logger.error("Failed to catch up %d soft-deactivated users", len(failures)) # nocoveragereturn users_caught_up