fix(tests): replace WaitForJobAsync with Task.Delay to avoid concurrent SQLite access#34
Merged
JerrettDavis merged 1 commit intomainfrom Apr 20, 2026
Merged
Conversation
…nt SQLite access in ProcessJob_HandlerFails_MarksJobAsFailed Agent-Logs-Url: https://github.com/JerrettDavis/StableDiffusionStudio/sessions/e0fa7a79-1443-46b7-a1b0-c32cc9390a9d Co-authored-by: JerrettDavis <2610199+JerrettDavis@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
JerrettDavis
April 20, 2026 16:00
View session
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Code Coverage |
Test Results417 tests 417 ✅ 35s ⏱️ Results for commit 0edd541. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #34 +/- ##
==========================================
+ Coverage 46.65% 55.27% +8.61%
==========================================
Files 117 117
Lines 5733 5733
Branches 774 774
==========================================
+ Hits 2675 3169 +494
+ Misses 2953 2564 -389
+ Partials 105 0 -105
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR Validation ResultsVersion: Validation Steps
This comment was automatically generated by the PR validation workflow. |
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.
Summary
Fixes the CI failure where
ProcessJob_HandlerFails_MarksJobAsFailedconsistently returnedJobStatus.Pendinginstead ofJobStatus.Failed.Root Cause
WaitForJobAsyncpolled the sharedSqliteConnectionevery 100ms from the test thread while theBackgroundJobProcessorwas writing to it on a background thread.SqliteConnectionis not thread-safe — concurrent access from two threads on the same connection object caused the processor'sSaveChangesAsynccalls to fail (e.g. with a "database is locked" error). Because the exception from the catch block'sSaveChangesAsyncpropagated to the outerExecuteAsynchandler (which only logs), the job was silently left inPendingstate.Changes
BackgroundJobProcessorTests.cs: Replaced theWaitForJobAsyncpolling approach inProcessJob_HandlerFails_MarksJobAsFailedwithTask.Delay(500)+ cancellation + stop before reading the result — consistent withProcessJob_MissingHandler_MarksJobAsFailedand all other tests in the class. Removed the now-unusedWaitForJobAsynchelper method.Verification
All 417 infrastructure tests pass locally.