@remit/imap-worker 0.0.92 → 0.0.93

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.
@@ -2,6 +2,9 @@ import { attemptBudget } from "@remit/sqs-client/attempt-budget";
2
2
  import { DEFAULT_MAILBOX_FRESHNESS_MS, defaultImapWorkerConfig, } from "./context.js";
3
3
  import { workerVersion } from "./worker-version.js";
4
4
  const DEFAULT_CONNECTIONS_PER_ACCOUNT = 2;
5
+ const BODY_BATCH_SIZE = 200;
6
+ const BODY_PROCESS_CONCURRENCY = 8;
7
+ const BODY_PROCESS_BYTES_IN_FLIGHT = 256 * 1024 * 1024;
5
8
  // Deployments that drive sync from a test harness set MAILBOX_FRESHNESS_MS low
6
9
  // so their explicit nudges are never no-oped by the freshness gate.
7
10
  export const resolveMailboxFreshnessMs = (env) => {
@@ -23,7 +26,9 @@ export const imapWorkerConfigFromEnv = (env) => {
23
26
  messageDelete: attemptBudget("MESSAGE_DELETE_MAX_ATTEMPTS", attempts.messageDelete, env),
24
27
  messageCopy: attemptBudget("MESSAGE_COPY_MAX_ATTEMPTS", attempts.messageCopy, env),
25
28
  },
26
- bodyBatchSize: defaultImapWorkerConfig.bodyBatchSize,
29
+ bodyBatchSize: BODY_BATCH_SIZE,
30
+ bodyProcessConcurrency: BODY_PROCESS_CONCURRENCY,
31
+ bodyProcessBytesInFlight: BODY_PROCESS_BYTES_IN_FLIGHT,
27
32
  mailboxFreshnessMs: resolveMailboxFreshnessMs(env),
28
33
  workerVersion: workerVersion(),
29
34
  };
package/dist/context.d.ts CHANGED
@@ -29,6 +29,8 @@ export interface AttemptBudgets {
29
29
  export interface ImapWorkerConfig {
30
30
  readonly attempts: AttemptBudgets;
31
31
  readonly bodyBatchSize: number;
32
+ readonly bodyProcessConcurrency: number;
33
+ readonly bodyProcessBytesInFlight: number;
32
34
  readonly mailboxFreshnessMs: number;
33
35
  readonly workerVersion: string;
34
36
  }
@@ -43,4 +45,4 @@ export interface ProcessContext {
43
45
  readonly accountObjects: AccountObjectStore;
44
46
  }
45
47
  export declare const DEFAULT_MAILBOX_FRESHNESS_MS = 60000;
46
- export declare const defaultImapWorkerConfig: Omit<ImapWorkerConfig, "workerVersion">;
48
+ export declare const defaultImapWorkerConfig: Omit<ImapWorkerConfig, "workerVersion" | "bodyBatchSize" | "bodyProcessConcurrency" | "bodyProcessBytesInFlight">;
package/dist/context.js CHANGED
@@ -10,6 +10,5 @@ export const defaultImapWorkerConfig = {
10
10
  messageDelete: 3,
11
11
  messageCopy: 3,
12
12
  },
13
- bodyBatchSize: 200,
14
13
  mailboxFreshnessMs: DEFAULT_MAILBOX_FRESHNESS_MS,
15
14
  };
@@ -132,7 +132,11 @@ export const syncMessageBody = async (event, ctx, receiveCount) => {
132
132
  placement: await resolveFolderPlacement(mailboxSpecialUseService, accountId, mailbox.mailboxId),
133
133
  };
134
134
  await (async () => {
135
- const result = await bodySyncService.syncBodies(messageIds, accountId, account.accountConfigId, folder, getConnectionChecked, force);
135
+ const result = await bodySyncService.syncBodies(messageIds, accountId, account.accountConfigId, folder, getConnectionChecked, {
136
+ force,
137
+ concurrency: config.bodyProcessConcurrency,
138
+ bytesInFlight: config.bodyProcessBytesInFlight,
139
+ });
136
140
  if (result.failedMessageIds.length === 0) {
137
141
  return;
138
142
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/imap-worker",
3
- "version": "0.0.92",
3
+ "version": "0.0.93",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {