Fix: Add API for Orion in Scorpio and update Orion to fit the changes, allowing it to build successfully.#1301
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
aa49770 to
f6c9c59
Compare
f6c9c59 to
e4a9dc0
Compare
e4a9dc0 to
45ea64b
Compare
45ea64b to
34c88a0
Compare
34c88a0 to
0aa95e2
Compare
0aa95e2 to
5e5f596
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds asynchronous mount API functionality to Scorpio and updates Orion to handle the new asynchronous mount workflow. The changes enable Orion to initiate mount requests through Scorpio's API and poll for completion status rather than waiting synchronously.
Key changes:
- Modified Scorpio's mount handler to return immediately with a request ID and track mount operations asynchronously
- Added new
/api/fs/selectendpoint in Scorpio for querying mount task status - Updated Orion's buck controller to use the new asynchronous mount API with polling mechanism
Reviewed Changes
Copilot reviewed 15 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| scorpio/src/daemon/mod.rs | Major refactor to implement asynchronous mount operations with task tracking and status querying |
| scorpio/scorpio.toml | Configuration change to reduce load directory depth |
| orion/src/buck_controller.rs | Updated mount function to use async API with polling and better error handling |
| orion/Cargo.toml | Added JSON feature to reqwest dependency |
| orion/.env | Updated environment configuration paths |
| Other files | Code formatting and import organization improvements |
| } | ||
|
|
||
| // Invalid request: neither request_id nor path provided | ||
| // TODO: Consider implementing cleanup for completed tasks to prevent memory leaks |
There was a problem hiding this comment.
The TODO comment indicates a memory leak concern. The tasks DashMap will grow indefinitely as completed tasks are never removed. Consider implementing a cleanup mechanism or TTL for completed tasks to prevent unbounded memory growth.
| let max_attempts = 30; | ||
|
|
||
| for _attempt in 1..=max_attempts { |
There was a problem hiding this comment.
The hardcoded max_attempts value of 30 should be configurable or at least defined as a named constant to improve maintainability and allow for easier tuning.
| let max_attempts = 30; | |
| for _attempt in 1..=max_attempts { | |
| for _attempt in 1..=MAX_ATTEMPTS { |
|
|
||
| for _attempt in 1..=max_attempts { | ||
| // Wait before checking status | ||
| sleep(Duration::from_secs(10)).await; |
There was a problem hiding this comment.
The hardcoded 10-second polling interval should be configurable or defined as a named constant to improve maintainability and allow for different polling strategies.
| sleep(Duration::from_secs(10)).await; | |
| sleep(Duration::from_secs(MOUNT_POLL_INTERVAL_SECS)).await; |
| } | ||
|
|
||
| // Secondary lookup method: search by path | ||
| // This is less efficient as it requires iterating through all tasks |
There was a problem hiding this comment.
The path-based lookup requires O(n) iteration through all tasks. Consider adding a secondary index (path -> request_id mapping) to improve lookup performance, especially as the number of concurrent tasks grows.
…, allowing it to build successfully.
5e5f596 to
c460bbe
Compare
|
LGTM |
Part of #1274
scorpio里面添加api用于orion来创建拉取任务和获取任务状态,并修改orion进行适配