Add timeout 504 handling for single file, single worker scan requests#74
Add timeout 504 handling for single file, single worker scan requests#74
Conversation
…. Update unit tests to validate settings
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughEnabled the Changes
Sequence DiagramsequenceDiagram
participant Client
participant APIService
participant scanWfp as scanWfp Function
participant Engine as Scan Engine
participant Response
rect rgba(200,150,100,0.5)
Note over APIService,Engine: Normal Scan Flow
Client->>APIService: POST /scan
APIService->>scanWfp: call scanWfp(wfp, sbomFile,...)
scanWfp->>Engine: execute scan command
Engine-->>scanWfp: success (output)
scanWfp-->>APIService: (output, false, nil)
APIService->>Response: HTTP 200 with results
Response-->>Client: return results
end
rect rgba(100,150,200,0.5)
Note over APIService,Engine: Timeout Scenario
Client->>APIService: POST /scan
APIService->>scanWfp: call scanWfp(wfp, sbomFile,...)
scanWfp->>Engine: execute scan command
Engine-->>scanWfp: context timeout detected
scanWfp-->>APIService: (output, true, error)
APIService->>Response: HTTP 504 "ERROR engine scan timed out"
Response-->>Client: timeout response
end
rect rgba(200,100,100,0.5)
Note over APIService,Engine: Non-timeout Error
Client->>APIService: POST /scan
APIService->>scanWfp: call scanWfp(wfp, sbomFile,...)
scanWfp->>Engine: execute scan command
Engine-->>scanWfp: failure (error)
scanWfp-->>APIService: (output, false, error)
APIService->>Response: HTTP 500 "ERROR engine scan failed"
Response-->>Client: error response
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test-support/scanoss-slow.sh`:
- Around line 27-32: Call scanoss.sh with the caller's arguments and fix the
exit-status check: invoke "$d"/scanoss.sh with "$@" so arguments from scanWfp
are forwarded, capture its exit code in EXIT_CODE as before, and change the
conditional from testing non-empty ("[ $EXIT_CODE ]") to an explicit zero check
(e.g., "[ \"$EXIT_CODE\" -eq 0 ]") before sleeping using DELAY.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: eb6e3a53-869d-414e-a714-d8d27e27663f
📒 Files selected for processing (5)
.golangci.ymlpkg/service/kb_details.gopkg/service/scanning_service.gopkg/service/scanning_service_test.gotest-support/scanoss-slow.sh
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores