🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix: prevent BlobStorageIntegrationProcessing requeue deadlocks on failed retries (#12525)
Copilotf80b2127783c
diff --git a/packages/shared/src/server/redis/blobStorageIntegrationProcessingQueue.ts b/packages/shared/src/server/redis/blobStorageIntegrationProcessingQueue.tsindex e8d506ec86..51e210d5f5 100644--- a/packages/shared/src/server/redis/blobStorageIntegrationProcessingQueue.ts+++ b/packages/shared/src/server/redis/blobStorageIntegrationProcessingQueue.ts@@ -28,7 +28,7 @@ export class BlobStorageIntegrationProcessingQueue {),defaultJobOptions: {removeOnComplete: true,- removeOnFail: 100_000,+ removeOnFail: true,attempts: 5,backoff: {type: "exponential",diff --git a/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts b/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.tsindex 59d4a1abbd..61486e1720 100644--- a/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts+++ b/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts@@ -449,7 +449,7 @@ export const handleBlobStorageIntegrationProjectJob = async (timestamp: new Date(),payload: { projectId },},- { jobId },+ { jobId, removeOnFail: true },);logger.info(`[BLOB INTEGRATION] Queued next catch-up chunk for project ${projectId} with jobId ${jobId}`,diff --git a/worker/src/features/blobstorage/handleBlobStorageIntegrationSchedule.ts b/worker/src/features/blobstorage/handleBlobStorageIntegrationSchedule.tsindex 5a1ef9c846..88b1ec1ea5 100644--- a/worker/src/features/blobstorage/handleBlobStorageIntegrationSchedule.ts+++ b/worker/src/features/blobstorage/handleBlobStorageIntegrationSchedule.ts@@ -6,6 +6,8 @@ import {} from "@langfuse/shared/src/server";import { randomUUID } from "crypto";+let legacyJobsDrained = false;+export const handleBlobStorageIntegrationSchedule = async () => {const now = new Date();@@ -41,6 +43,17 @@ export const handleBlobStorageIntegrationSchedule = async () => {`Scheduling ${blobStorageIntegrationProjects.length} blob storage integrations for sync`,);+ if (!legacyJobsDrained) {+ // One-time cleanup: remove failed jobs left over from before the+ // removeOnFail: true fix. These jobs block re-queuing due to jobId+ // deduplication.+ await blobStorageIntegrationProcessingQueue.clean(0, 0, "failed");+ legacyJobsDrained = true;+ logger.info(+ "[BLOB INTEGRATION] Drained legacy failed jobs from processing queue",+ );+ }+await blobStorageIntegrationProcessingQueue.addBulk(blobStorageIntegrationProjects.map((integration) => ({name: QueueJobs.BlobStorageIntegrationProcessingJob,@@ -53,8 +66,11 @@ export const handleBlobStorageIntegrationSchedule = async () => {},},opts: {- // Use projectId and last sync as jobId to prevent duplicate jobs.+ // Deduplicate by projectId + lastSyncAt so the same project isn't queued+ // twice for the same sync window. removeOnFail ensures failed jobs are+ // immediately cleaned up so they don't block re-queuing on the next cycle.jobId: `${integration.projectId}-${integration.lastSyncAt?.toISOString() ?? ""}`,+ removeOnFail: true,},})),);