@remit/smtp-worker 0.0.13 → 0.0.14
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/e2e-processor-shim.ts +12 -6
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
2
3
|
import {
|
|
3
4
|
DeleteMessageCommand,
|
|
4
5
|
ReceiveMessageCommand,
|
|
@@ -46,11 +47,16 @@ process.on("SIGTERM", () => {
|
|
|
46
47
|
isShuttingDown = true;
|
|
47
48
|
});
|
|
48
49
|
|
|
49
|
-
// Minimal Lambda Context: `withTelemetry`
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
// Minimal Lambda Context: `withTelemetry` reads `functionName` for the line it
|
|
51
|
+
// logs per invocation and `awsRequestId` for the scope it opens around it, so
|
|
52
|
+
// every line one batch produces shares a `requestId` (deploy/vps/README.md,
|
|
53
|
+
// "Logs"). Minted per batch, like the production poller does — a context built
|
|
54
|
+
// once would put the whole run under one id, which correlates nothing.
|
|
55
|
+
const nextContext = (): Context =>
|
|
56
|
+
({
|
|
57
|
+
functionName: `e2e-smtp-worker-${queueName}`,
|
|
58
|
+
awsRequestId: randomUUID(),
|
|
59
|
+
}) as Context;
|
|
54
60
|
|
|
55
61
|
const pollQueue = async (): Promise<void> => {
|
|
56
62
|
log.info("Worker started, polling...", { maxMessages });
|
|
@@ -115,7 +121,7 @@ const pollQueue = async (): Promise<void> => {
|
|
|
115
121
|
})),
|
|
116
122
|
};
|
|
117
123
|
|
|
118
|
-
const result = (await handler(event,
|
|
124
|
+
const result = (await handler(event, nextContext())) as
|
|
119
125
|
| SQSBatchResponse
|
|
120
126
|
| undefined;
|
|
121
127
|
|