Skip to content

Commit

Permalink
fix: allow int idempotency keys (#648)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcoraven committed Sep 6, 2024
1 parent 8214dc3 commit d1ed9e9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/worker/queues/mineTransactionQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class MineTransactionQueue {

// There must be a worker to poll the result for every transaction hash,
// even for the same queueId. This handles if any retried transactions succeed.
static jobId = (data: MineTransactionData) => data.queueId;
static jobId = (data: MineTransactionData) => `mine.${data.queueId}`;

static add = async (data: MineTransactionData) => {
const serialized = superjson.stringify(data);
Expand Down
2 changes: 1 addition & 1 deletion src/worker/queues/sendTransactionQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class SendTransactionQueue {

// Allow enqueing the same queueId for multiple retries.
static jobId = (data: SendTransactionData) =>
`${data.queueId}:${data.resendCount}`;
`${data.queueId}.${data.resendCount}`;

static add = async (data: SendTransactionData) => {
const serialized = superjson.stringify(data);
Expand Down
6 changes: 3 additions & 3 deletions src/worker/queues/sendWebhookQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ export class SendWebhookQueue {
const { webhook, eventLog, transactionReceipt } = args;

if (eventLog) {
return `${webhook.url}:${eventLog.transactionHash}:${eventLog.logIndex}`;
return `${webhook.url}.${eventLog.transactionHash}.${eventLog.logIndex}`;
} else if (transactionReceipt) {
return `${webhook.url}:${transactionReceipt.transactionHash}`;
return `${webhook.url}.${transactionReceipt.transactionHash}`;
}
throw 'Must provide "eventLog" or "transactionReceipt".';
};
Expand Down Expand Up @@ -139,5 +139,5 @@ export class SendWebhookQueue {
webhook: Webhooks;
eventType: WebhooksEventTypes;
queueId: string;
}) => `${args.webhook.url}:${args.eventType}:${args.queueId}`;
}) => `${args.webhook.url}.${args.eventType}.${args.queueId}`;
}

0 comments on commit d1ed9e9

Please sign in to comment.