diff --git a/packages/worker/src/email/inbound-effects.ts b/packages/worker/src/email/inbound-effects.ts index 835d79593e..8de933905d 100644 --- a/packages/worker/src/email/inbound-effects.ts +++ b/packages/worker/src/email/inbound-effects.ts @@ -305,6 +305,7 @@ export async function processInboundDeliveryEffects( return await withAccountWriteLease({ db: input.env.APP_DB, stableUserId: input.userId, + env: input.env, write: async () => await processUserInboundDeliveryEffectsWithLeaseHeld(input), }) diff --git a/packages/worker/src/email/inbound.ts b/packages/worker/src/email/inbound.ts index 886149aac7..d72bb1596f 100644 --- a/packages/worker/src/email/inbound.ts +++ b/packages/worker/src/email/inbound.ts @@ -232,6 +232,7 @@ export async function handleInboundEmail( return await withAccountWriteLease({ db: env.APP_DB, stableUserId: userId, + env, async write() { await assertUserEmailGraphAuthority({ db: env.APP_DB, diff --git a/packages/worker/src/email/outbound.ts b/packages/worker/src/email/outbound.ts index 57a49f48fd..b18ad9e3b3 100644 --- a/packages/worker/src/email/outbound.ts +++ b/packages/worker/src/email/outbound.ts @@ -962,6 +962,7 @@ export async function sendOutboundEmail( ? await withAccountWriteLease({ db: input.env.APP_DB, stableUserId: input.userId, + env: input.env, write, }) : await write() diff --git a/packages/worker/src/email/reconcile-inbound-deliveries.ts b/packages/worker/src/email/reconcile-inbound-deliveries.ts index 70c686c76f..35c223a1c8 100644 --- a/packages/worker/src/email/reconcile-inbound-deliveries.ts +++ b/packages/worker/src/email/reconcile-inbound-deliveries.ts @@ -201,6 +201,7 @@ export async function sweepStaleInboundDeliveries(input: { : await withAccountWriteLease({ db: input.env.APP_DB, stableUserId: userId, + env: input.env, write: reconcileUser, }) recovered += result.recovered