@remit/imap-worker 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
IEnvelopeRepository,
|
|
7
7
|
IMailboxRepository,
|
|
8
8
|
IMessageFlagPushRepository,
|
|
9
|
+
IMessageFlagRepository,
|
|
9
10
|
IMessageRepository,
|
|
10
11
|
IThreadMessageRepository,
|
|
11
12
|
IUnitOfWork,
|
|
@@ -70,6 +71,7 @@ export const syncMessages = async (
|
|
|
70
71
|
threadMessage: threadMessageService,
|
|
71
72
|
mailboxLock: mailboxLockService,
|
|
72
73
|
flagPush: flagPushMarkerService,
|
|
74
|
+
messageFlag: messageFlagService,
|
|
73
75
|
unitOfWork,
|
|
74
76
|
secrets,
|
|
75
77
|
} = await getClient();
|
|
@@ -137,6 +139,7 @@ export const syncMessages = async (
|
|
|
137
139
|
addressService,
|
|
138
140
|
threadMessageService,
|
|
139
141
|
flagPushMarkerService,
|
|
142
|
+
messageFlagService,
|
|
140
143
|
unitOfWork,
|
|
141
144
|
},
|
|
142
145
|
log,
|
|
@@ -179,6 +182,7 @@ interface SyncDeps {
|
|
|
179
182
|
addressService: IAddressRepository;
|
|
180
183
|
threadMessageService: IThreadMessageRepository;
|
|
181
184
|
flagPushMarkerService: IMessageFlagPushRepository;
|
|
185
|
+
messageFlagService: IMessageFlagRepository;
|
|
182
186
|
unitOfWork?: IUnitOfWork;
|
|
183
187
|
}
|
|
184
188
|
|
|
@@ -269,6 +273,7 @@ const syncMailboxMessages = async (
|
|
|
269
273
|
addressService,
|
|
270
274
|
threadMessageService,
|
|
271
275
|
flagPushMarkerService,
|
|
276
|
+
messageFlagService,
|
|
272
277
|
unitOfWork,
|
|
273
278
|
} = deps;
|
|
274
279
|
|
|
@@ -300,6 +305,8 @@ const syncMailboxMessages = async (
|
|
|
300
305
|
threadMessageService,
|
|
301
306
|
log,
|
|
302
307
|
unitOfWork,
|
|
308
|
+
flagPushMarkerService,
|
|
309
|
+
messageFlagService,
|
|
303
310
|
);
|
|
304
311
|
|
|
305
312
|
// Connect once, reuse for the entire sync operation
|
|
@@ -331,6 +338,16 @@ const syncMailboxMessages = async (
|
|
|
331
338
|
);
|
|
332
339
|
}
|
|
333
340
|
|
|
341
|
+
// A stalled cursor is the one failure on this path that produces no error:
|
|
342
|
+
// unapplicable messages are caught and held back, so the round returns
|
|
343
|
+
// normally, the SQS record is deleted, and neither redrive nor the DLQ ever
|
|
344
|
+
// engages. Without this metric the mailbox stops syncing behind a worker
|
|
345
|
+
// that looks healthy. It is emitted as a count so a sustained non-zero
|
|
346
|
+
// value alarms, per-mailbox detail being in the accompanying ERROR log.
|
|
347
|
+
if (result.cursorStalled) {
|
|
348
|
+
metrics.addMetric("imapSyncCursorStalled", MetricUnit.Count, 1);
|
|
349
|
+
}
|
|
350
|
+
|
|
334
351
|
// Emit body sync events for the messages we just synced. Each event carries
|
|
335
352
|
// messageId+uid pairs so the consumer issues one ranged FETCH per batch
|
|
336
353
|
// without re-resolving UIDs. messageIds stays populated for backward compat.
|