Skip to content

Commit 331dd5d

Browse files
committed
Add logging to poller and sequencer
1 parent 03ff4c0 commit 331dd5d

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

  • apps/backend/src/app/api/latest/internal/external-db-sync

apps/backend/src/app/api/latest/internal/external-db-sync/poller/route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ export const GET = createSmartRouteHandler({
214214
await upstash.batchJSON(batchPayload);
215215
await deleteOutgoingRequests(requests.map((request) => request.id));
216216
processSpan.setAttribute("stack.external-db-sync.processed-count", requests.length);
217+
console.log(`[Poller] Processed requests: ${requests.length}`);
217218
return requests.length;
218219
} catch (error) {
219220
processSpan.setAttribute("stack.external-db-sync.iteration-error", true);

apps/backend/src/app/api/latest/internal/external-db-sync/sequencer/route.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ async function backfillSequenceIds(batchSize: number): Promise<boolean> {
137137
}
138138

139139
span.setAttribute("stack.external-db-sync.did-update", didUpdate);
140+
if (didUpdate) {
141+
console.log(`[Sequencer] Backfilled sequence IDs: USR=${projectUserTenants.length}, CC=${contactChannelTenants.length}, DR=${deletedRowTenants.length}`);
142+
}
140143

141144
return didUpdate;
142145
});
@@ -211,6 +214,7 @@ export const GET = createSmartRouteHandler({
211214
try {
212215
const didUpdate = await backfillSequenceIds(batchSize);
213216
iterationSpan.setAttribute("stack.external-db-sync.did-update", didUpdate);
217+
console.log(`[Sequencer] Backfilled ${didUpdate ? "some" : "no"} sequence IDs`);
214218
} catch (error) {
215219
iterationSpan.setAttribute("stack.external-db-sync.iteration-error", true);
216220
captureError(

0 commit comments

Comments
 (0)