@remit/search-index-worker 0.0.15 → 0.0.16
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/consumer.ts +3 -4
- package/src/data-ports.ts +4 -5
- package/src/handler.ts +2 -3
package/package.json
CHANGED
package/src/consumer.ts
CHANGED
|
@@ -50,10 +50,9 @@ export interface SqsConsumerConfig {
|
|
|
50
50
|
* via `processBatch` (a batch of one) — the same per-message logic the AWS
|
|
51
51
|
* Lambda handler runs, reused so the two deployment shapes (Lambda event
|
|
52
52
|
* source mapping vs. a long-running container/pm2 process) share one
|
|
53
|
-
* indexing implementation. Used by the
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* see its `worker.ts`), it does not consume them.
|
|
53
|
+
* indexing implementation. Used by the self-host stack, where the search-index
|
|
54
|
+
* queue has no Lambda event source: the outbox drain relays committed events
|
|
55
|
+
* onto this queue (the producer side) and this consumer takes them off it.
|
|
57
56
|
*
|
|
58
57
|
* A message is deleted only when `processBatch` reports no failure for it;
|
|
59
58
|
* a failure leaves it on the queue so its visibility timeout lapses and SQS
|
package/src/data-ports.ts
CHANGED
|
@@ -17,11 +17,10 @@ export interface SearchIndexDataPorts {
|
|
|
17
17
|
* one — this hook is `undefined` there, and the handler uses the message's
|
|
18
18
|
* own `accountId` unchanged (see `prepareUpsert` in handler.ts).
|
|
19
19
|
*
|
|
20
|
-
* The
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* retried — see handler.ts).
|
|
20
|
+
* The outbox carries a plain `message_id`, so the relational drain has no
|
|
21
|
+
* accountId to attach; this hook derives it from the message's mailbox at
|
|
22
|
+
* consume time instead. Returns null when the mailbox can't be resolved (the
|
|
23
|
+
* message is skipped, not retried — see handler.ts).
|
|
25
24
|
*/
|
|
26
25
|
resolveAccountId?: (messageId: string) => Promise<string | null>;
|
|
27
26
|
}
|
package/src/handler.ts
CHANGED
|
@@ -86,9 +86,8 @@ const deleteMessage = async (
|
|
|
86
86
|
// upsert per message means a record S3 Vectors rejects (e.g. a metadata
|
|
87
87
|
// ValidationException) dead-letters on its own — its siblings in the
|
|
88
88
|
// batch still index instead of retrying forever behind a poison record.
|
|
89
|
-
// Exported so the long-running
|
|
90
|
-
//
|
|
91
|
-
// this exact logic.
|
|
89
|
+
// Exported so the long-running consumer (`consumer.ts`) can process one
|
|
90
|
+
// message at a time outside the Lambda batch shape, reusing this exact logic.
|
|
92
91
|
export const upsertMessage = async (
|
|
93
92
|
message: Extract<ParsedQueueMessage, { kind: "upsert" }>,
|
|
94
93
|
services: Services,
|