Add consistent uploadId/batchId log prefix on the worker's call path - #114
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
Confidence Score: 5/5This looks safe to merge after a small hardening cleanup in queue removal logging.
backend/src/workers/queue.ts Important Files Changed
Reviews (1): Last reviewed commit: "feat: add consistent uploadId/batchId lo..." | Re-trigger Greptile |
Comment on lines
+54
to
+56
| logger.info( | ||
| `[worker] ${idTag(job.data.uploadId, job.data.batchId)} job ${jobId} removed from queue`, | ||
| ) |
Contributor
There was a problem hiding this comment.
When removeUploadJob removes an existing BullMQ job whose stored data is missing or from an older shape, the new log line reads job.data.uploadId and job.data.batchId after the remove. The old path could remove the job using only jobId; this path can now reject during cleanup or emit [undefined/undefined], which can break callers that cancel or requeue stale jobs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Log lines reachable from the upload worker's job processing identified the upload/batch inconsistently — some interpolated
[uploadId/batchId]into the message, some duplicated it as a redundant structured pino field, and several call sites (tokenRetry.ts, most ofmediawiki/client.ts,handlers/mapillary.ts) had no id at all.idTag(uploadId, batchId)helper incore/logger.tsupload.worker.tsandworkers/queue.tsnow build the tag once and use it consistently, dropping redundant structured id duplicatesMediaWikiClient.applySdc/.nullEditandMapillaryHandler.fetchImagesBatch/fetchImagesByIdsnow accept the tag so their log lines (chunk upload, SDC apply, null edit, retries) carry it toofetchImagesBatch/fetchImagesByIds's tag param is optional (default'') since they're also called from a WS collection-browsing flow with no upload/batch contexttokenRetry.tsneeded no changes — callers now embed the tag in thelabelstring they already pass in— Claude Sonnet 5