fix: gate provisioning on mailu mailbox
This commit is contained in:
parent
1dabd78921
commit
ce66744a9e
@ -307,6 +307,7 @@ class ProvisioningManager:
|
||||
|
||||
# Task: trigger Mailu sync
|
||||
start = datetime.now(timezone.utc)
|
||||
mailbox_ready = True
|
||||
try:
|
||||
if not settings.mailu_sync_url:
|
||||
detail = "sync disabled"
|
||||
@ -314,13 +315,22 @@ class ProvisioningManager:
|
||||
self._record_task(request_code, "mailu_sync", "ok", detail, start)
|
||||
else:
|
||||
mailu.sync(reason="ariadne_access_approve", force=True)
|
||||
mailbox_ready = mailu.wait_for_mailbox(
|
||||
mailu_email, settings.mailu_mailbox_wait_timeout_sec
|
||||
)
|
||||
if not mailbox_ready:
|
||||
raise RuntimeError("mailbox not ready")
|
||||
self._upsert_task(conn, request_code, "mailu_sync", "ok", None)
|
||||
self._record_task(request_code, "mailu_sync", "ok", None, start)
|
||||
except Exception as exc:
|
||||
mailbox_ready = False
|
||||
detail = safe_error_detail(exc, "failed to sync mailu")
|
||||
self._upsert_task(conn, request_code, "mailu_sync", "error", detail)
|
||||
self._record_task(request_code, "mailu_sync", "error", detail, start)
|
||||
|
||||
if not mailbox_ready:
|
||||
return ProvisionOutcome(ok=False, status="accounts_building")
|
||||
|
||||
# Task: trigger Nextcloud mail sync
|
||||
start = datetime.now(timezone.utc)
|
||||
try:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user