Improve 'tries' naming scheme and implement exponential retry delay with jitter

This commit is contained in:
Dominic Ferrando
2026-07-15 15:37:40 -04:00
parent fd94f22d21
commit 67886d0f6c
3 changed files with 38 additions and 21 deletions
+5 -4
View File
@@ -6,6 +6,7 @@ import { Type as t } from "@sinclair/typebox";
import { Value } from "@sinclair/typebox/value";
import { sql } from "kysely";
import zipcodesUs from "zipcodes-us";
import { minToMs, secToMs } from "@blade-and-brawn/domain";
export class CommerceService {
readonly Printful = new PrintfulClient({
@@ -37,8 +38,8 @@ class ApparelOrdersService {
this.Queue = new EventQueue({
group: "apparel_order",
cfg: {
retry: { limit: 3, delayMs: 10000 },
concurrency: { limit: 1, timeoutMs: 600000 }
error: { limit: 3, initialRetryDelayMs: secToMs(1) },
concurrency: { limit: 1, timeoutMs: minToMs(10) }
},
events: {
"apparel_order_create": defineEventType({
@@ -105,8 +106,8 @@ class ApparelSyncService {
this.Queue = new EventQueue({
group: "apparel_sync",
cfg: {
retry: { limit: 3, delayMs: 10000 },
concurrency: { limit: 1, timeoutMs: 600000 }
error: { limit: 3, initialRetryDelayMs: secToMs(1) },
concurrency: { limit: 1, timeoutMs: minToMs(10) }
},
events: {
"apparel_sync_update": defineEventType({