@remit/imap-worker 0.0.28 → 0.0.29
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 +1 -1
- package/src/cli.ts +6 -0
- package/src/e2e-processor-shim.ts +12 -6
- package/src/handlers/sync-mailboxes.ts +1 -0
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// Plain text on purpose, and the one deliberate exception to the log field
|
|
3
|
+
// contract in deploy/vps/README.md ("Logs"). That contract covers what a
|
|
4
|
+
// container's log driver ships; this file is the `remit-worker` bin, run by hand
|
|
5
|
+
// against a terminal, and is not an entrypoint of any image (see the target list
|
|
6
|
+
// in npm-scripts/docker-bundle.mjs). Do not route it through the logger — usage
|
|
7
|
+
// text and argument errors are for the person who typed the command.
|
|
2
8
|
import { parseArgs } from "node:util";
|
|
3
9
|
import { emitEvent } from "./emit.js";
|
|
4
10
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import cluster from "node:cluster";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
3
4
|
import {
|
|
4
5
|
DeleteMessageCommand,
|
|
5
6
|
ReceiveMessageCommand,
|
|
@@ -129,11 +130,16 @@ if (cluster.isPrimary) {
|
|
|
129
130
|
isShuttingDown = true;
|
|
130
131
|
});
|
|
131
132
|
|
|
132
|
-
// Minimal Lambda Context: `withTelemetry`
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
// Minimal Lambda Context: `withTelemetry` reads `functionName` for the line it
|
|
134
|
+
// logs per invocation and `awsRequestId` for the scope it opens around it, so
|
|
135
|
+
// every line one batch produces shares a `requestId` (deploy/vps/README.md,
|
|
136
|
+
// "Logs"). Minted per batch, like the production poller does — a context built
|
|
137
|
+
// once would put the whole run under one id, which correlates nothing.
|
|
138
|
+
const nextContext = (): Context =>
|
|
139
|
+
({
|
|
140
|
+
functionName: `e2e-imap-worker-${queueName}`,
|
|
141
|
+
awsRequestId: randomUUID(),
|
|
142
|
+
}) as Context;
|
|
137
143
|
|
|
138
144
|
const pollQueue = async (): Promise<void> => {
|
|
139
145
|
log.info({ maxMessages }, "Worker started, polling...");
|
|
@@ -200,7 +206,7 @@ if (cluster.isPrimary) {
|
|
|
200
206
|
})),
|
|
201
207
|
};
|
|
202
208
|
|
|
203
|
-
const result = (await activeHandler(event,
|
|
209
|
+
const result = (await activeHandler(event, nextContext(), () => {})) as
|
|
204
210
|
| SQSBatchResponse
|
|
205
211
|
| undefined;
|
|
206
212
|
|