@remit/imap-worker 0.0.19 → 0.0.20

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/imap-worker",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -14,7 +14,6 @@ import type {
14
14
  SQSHandler,
15
15
  } from "aws-lambda";
16
16
  import { env } from "expect-env";
17
- import { receiveVisibilitySeconds } from "./e2e-processor-visibility.js";
18
17
  import { handler } from "./index.js";
19
18
 
20
19
  /**
@@ -151,13 +150,7 @@ if (cluster.isPrimary) {
151
150
  QueueUrl: queueUrl,
152
151
  MaxNumberOfMessages: maxMessages,
153
152
  WaitTimeSeconds: waitTime,
154
- // A failed message is left un-deleted and only redelivers when this
155
- // window lapses; on the per-account FIFO sync queues that window is
156
- // also how long a single failure head-of-line blocks the account's
157
- // whole pipeline (#290). Keep it short for FIFO, long for the
158
- // standard queues whose slower work needs it. See
159
- // `receiveVisibilitySeconds`.
160
- VisibilityTimeout: receiveVisibilitySeconds(queueUrl),
153
+ VisibilityTimeout: 300,
161
154
  MessageSystemAttributeNames: ["ApproximateReceiveCount"],
162
155
  }),
163
156
  );
@@ -1,43 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { describe, it } from "node:test";
3
- import {
4
- FIFO_RECEIVE_VISIBILITY_SECONDS,
5
- receiveVisibilitySeconds,
6
- STANDARD_RECEIVE_VISIBILITY_SECONDS,
7
- } from "./e2e-processor-visibility.js";
8
-
9
- describe("receiveVisibilitySeconds", () => {
10
- it("gives the per-account FIFO sync queues a short window so a failure unblocks fast", () => {
11
- for (const url of [
12
- "http://localhost:9324/000/remit-mailboxes.fifo",
13
- "http://localhost:9324/000/remit-messages.fifo",
14
- "http://localhost:9324/000/remit-flags.fifo",
15
- ]) {
16
- assert.equal(
17
- receiveVisibilitySeconds(url),
18
- FIFO_RECEIVE_VISIBILITY_SECONDS,
19
- );
20
- }
21
- });
22
-
23
- it("keeps the long window for the standard body and management queues", () => {
24
- for (const url of [
25
- "http://localhost:9324/000/remit-body",
26
- "http://localhost:9324/000/remit-mailbox-mgmt",
27
- "http://localhost:9324/000/remit-message-mgmt",
28
- "http://localhost:9324/000/remit-search-index",
29
- ]) {
30
- assert.equal(
31
- receiveVisibilitySeconds(url),
32
- STANDARD_RECEIVE_VISIBILITY_SECONDS,
33
- );
34
- }
35
- });
36
-
37
- it("keeps the FIFO window short enough to unblock within a spec's seed budget, above a sync round's own duration", () => {
38
- assert.ok(FIFO_RECEIVE_VISIBILITY_SECONDS > 0);
39
- assert.ok(
40
- FIFO_RECEIVE_VISIBILITY_SECONDS < STANDARD_RECEIVE_VISIBILITY_SECONDS,
41
- );
42
- });
43
- });
@@ -1,27 +0,0 @@
1
- /**
2
- * Receive-time visibility (seconds) the e2e drainer requests for a queue.
3
- *
4
- * A message the handler reports as failed is left un-deleted and only
5
- * redelivers once its visibility lapses. The sync queues are per-account FIFO
6
- * (`MessageGroupId = accountId`): while one message sits invisible, every later
7
- * message in its group is held back too. So the visibility window a failed sync
8
- * event sits out is also the window the whole account's sync pipeline stalls —
9
- * and at a multi-minute window that stall swallows a spec's entire seed-and-wait
10
- * budget when a transient IMAP hiccup fails one event mid-run, which is the
11
- * recurring e2e-dev flake (#290).
12
- *
13
- * FIFO sync queues therefore get a short window: a transient failure costs one
14
- * brief retry instead of a minutes-long group stall, and the handlers on these
15
- * queues (a mailbox LIST, a header SEARCH/FETCH) finish well inside it — a rare
16
- * slow round redelivers harmlessly, since the mailbox lock makes a concurrent
17
- * re-run a no-op. The standard queues (body sync's ranged FETCH of up to 200
18
- * message bodies, the management queues) keep the longer window their slower,
19
- * non-FIFO work needs and where a redelivery blocks nothing but itself.
20
- */
21
- export const FIFO_RECEIVE_VISIBILITY_SECONDS = 30;
22
- export const STANDARD_RECEIVE_VISIBILITY_SECONDS = 300;
23
-
24
- export const receiveVisibilitySeconds = (queueUrl: string): number =>
25
- queueUrl.endsWith(".fifo")
26
- ? FIFO_RECEIVE_VISIBILITY_SECONDS
27
- : STANDARD_RECEIVE_VISIBILITY_SECONDS;