Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
farhanW3 committed Sep 28, 2023
1 parent 3641c2c commit 3a39830
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion server/controller/tx-update-listener.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { connectToDatabase } from "../../core";
import { getTxById } from "../../src/db/transactions/getTxById";
import { env } from "../../src/utils/env";
import { logger } from "../../src/utils/logger";

Expand All @@ -19,13 +20,15 @@ export const startTxUpdatesNotificationListener = async (): Promise<void> => {
);
const parsedPayload = JSON.parse(msg.payload);
if (env.WEBHOOKS_ENABLED && env.WEBHOOK_URL.length > 0) {
const txData = await getTxById({ queueId: parsedPayload.id });
const response = await fetch(env.WEBHOOK_URL!, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
Authorization: `Bearer ${env.THIRDWEB_API_SECRET_KEY}`,
},
body: JSON.stringify(parsedPayload),
body: JSON.stringify(txData),
});

logger.server.debug(
Expand Down
3 changes: 1 addition & 2 deletions src/worker/tasks/retryTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ export const retryTx = async () => {
try {
await prisma.$transaction(
async (pgtx) => {
logger.worker.info(`[Transaction] Retrying`);
logger.worker.debug(`[Transaction] Retrying`);
// Get one transaction to retry at a time
const tx = await getTxToRetry({ pgtx });
console.log("tx", tx);
if (!tx) {
return;
}
Expand Down

0 comments on commit 3a39830

Please sign in to comment.