fix: stop infinite polling when BlobImport progress returns NOT_FOUND#1501
fix: stop infinite polling when BlobImport progress returns NOT_FOUND#1501
Conversation
When getStatus returns NOT_FOUND for a deleted/aborted resource, setDone(true) was called but isProgressDone still returned false because it also required status.progress >= 1.0. Since status was never set in the error path, the task kept being polled indefinitely, producing 70K+ Sentry events. Fix isProgressDone to only check p.done, and downgrade the log from warn to info since resource deletion is expected behavior. Fixes PLATFORM-ELECTRON-KC2
🦋 Changeset detectedLatest commit: 2620c6a The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue where the UploadDriver would enter an infinite polling loop and generate excessive warnings when a BlobImport resource was deleted or aborted. By refining the logic that determines if a progress task is complete and adjusting the logging severity for expected termination scenarios, the change prevents unnecessary resource consumption and improves system stability. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the infinite polling issue when a BlobImport progress returns NOT_FOUND. The change to isProgressDone() correctly ensures that tasks are marked as complete when p.done is true, preventing indefinite re-polling. Additionally, downgrading the log level from warn to info for expected terminal states like resource deletion or abortion is a good improvement for log clarity, reducing potential alert fatigue. The changes are well-explained and directly resolve the identified root cause.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1501 +/- ##
==========================================
+ Coverage 54.69% 54.72% +0.02%
==========================================
Files 242 242
Lines 13587 13587
Branches 2789 2789
==========================================
+ Hits 7432 7435 +3
+ Misses 5225 5221 -4
- Partials 930 931 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| function isProgressDone(p: sdk.ImportProgress) { | ||
| return p.done && (p.status?.progress ?? 0.0) >= 1.0; |
There was a problem hiding this comment.
are you sure that was a dead code?
When a BlobImport resource is deleted or aborted (NOT_FOUND/ABORTED), PlFileInput was incorrectly showing a success state (green checkmark, 100% progress bar) because it only checked `done` for completion. Add `aborted` field to ImportProgress so the UI can distinguish successful completion from server-side termination. PlFileInput now shows the error icon with the actual error message when aborted.
| * was deleted or aborted on the server (e.g. NOT_FOUND / ABORTED). */ | ||
| aborted?: boolean; | ||
| /** Status of indexing/uploading got from platforma gRPC. */ | ||
| status?: ImportStatus; |
There was a problem hiding this comment.
Can we keep in status all statesd? done/aborted/progress/etc?
Summary
UploadDriverwhengetStatusreturnsNOT_FOUNDfor deleted/aborted resourcesisProgressDone()required bothp.doneANDp.status.progress >= 1.0, but terminal errors only setdone=truewithout updatingstatus— causing the task to be re-polled indefinitelywarntoinfosince resource deletion/abort is expected behavior, not an errorRoot cause
When
Progress/GetStatusreturnsNOT_FOUND(resource deleted or aborted),updateStatus()callssetDone(true)which setsprogress.done = true. However,isProgressDone()also checkedstatus.progress >= 1.0. Sincestatuswas never set in the error path (or was still at a partial value),isProgressDone()returnedfalse, keeping the task in the polling loop. Each poll produced anotherNOT_FOUND→ another Sentry warning → 70K+ events.Test plan
pnpm turbo run build --filter=@milaboratories/pl-drivers)upload.test.tscover the normal upload/index flowsFixes PLATFORM-ELECTRON-KC2