Skip to content

Commit 078b916

Browse files
committed
Auto-cleanup failed graphile jobs instead of keeping them around
1 parent dc53f0f commit 078b916

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

apps/webapp/app/platform/zodWorker.server.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,17 @@ export class ZodWorker<TMessageCatalog extends MessageCatalogSchema> {
577577
span.recordException(new Error(String(error)));
578578
}
579579

580+
if (job.attempts >= job.max_attempts) {
581+
logger.error("Job failed after max attempts", {
582+
job,
583+
attempts: job.attempts,
584+
max_attempts: job.max_attempts,
585+
error: error instanceof Error ? error.message : error,
586+
});
587+
588+
return;
589+
}
590+
580591
throw error;
581592
} finally {
582593
span.end();

apps/webapp/app/services/apiRateLimit.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ export const apiRateLimiter = authorizationRateLimitMiddleware({
191191
pathMatchers: [/^\/api/],
192192
// Allow /api/v1/tasks/:id/callback/:secret
193193
pathWhiteList: [
194+
"/api/internal/stripe_webhooks",
194195
"/api/v1/authorization-code",
195196
"/api/v1/token",
196197
/^\/api\/v1\/tasks\/[^\/]+\/callback\/[^\/]+$/, // /api/v1/tasks/$id/callback/$secret

apps/webapp/app/services/worker.server.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,6 @@ function getWorkerQueue() {
232232
return new ZodWorker({
233233
name: "workerQueue",
234234
prisma,
235-
cleanup: {
236-
frequencyExpression: "13,27,43 * * * *",
237-
ttl: env.WORKER_CLEANUP_TTL_DAYS * 24 * 60 * 60 * 1000, // X days
238-
maxCount: 1000,
239-
},
240235
runnerOptions: {
241236
connectionString: env.DATABASE_URL,
242237
concurrency: env.WORKER_CONCURRENCY,

0 commit comments

Comments
 (0)