Add short delay for already claimed event retryc
This commit is contained in:
@@ -46,6 +46,7 @@ function exponentialDelay(initialDelay: number, tries: number, cap: number = Inf
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class EventQueue<G extends string, T extends Record<string, EventTypeOptions<any, any>>> {
|
export class EventQueue<G extends string, T extends Record<string, EventTypeOptions<any, any>>> {
|
||||||
|
private static readonly DEQUEUE_ALREADY_CLAIMED_SKIP_DELAY_MS = 250;
|
||||||
private static readonly DEQUEUE_RETRY_DELAY_MS = secToMs(10);
|
private static readonly DEQUEUE_RETRY_DELAY_MS = secToMs(10);
|
||||||
private static readonly DEQUEUE_RETRY_LIMIT = 3;
|
private static readonly DEQUEUE_RETRY_LIMIT = 3;
|
||||||
private static readonly RATE_LIMIT_RETRY_LIMIT = 15;
|
private static readonly RATE_LIMIT_RETRY_LIMIT = 15;
|
||||||
@@ -78,6 +79,7 @@ export class EventQueue<G extends string, T extends Record<string, EventTypeOpti
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
if (err instanceof AlreadyClaimedEventError) {
|
if (err instanceof AlreadyClaimedEventError) {
|
||||||
log.warn("event processing already claimed by another worker, skipping");
|
log.warn("event processing already claimed by another worker, skipping");
|
||||||
|
await sleep(EventQueue.DEQUEUE_ALREADY_CLAIMED_SKIP_DELAY_MS);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (err instanceof ConcurrencyLimitReachedError) {
|
if (err instanceof ConcurrencyLimitReachedError) {
|
||||||
|
|||||||
Reference in New Issue
Block a user