mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Update dependencies and improve syncback handling
- Updated versions of several dependencies in `Cargo.lock`, including `async-compression` (0.4.40), `aws-lc-rs` (1.16.0), `bumpalo` (3.20.1), and `compression-codecs` (0.4.37), ensuring compatibility and access to the latest features and fixes. - Refactored the `fire` method in `SyncbackSignal` to return a boolean indicating whether a syncback was successfully initiated, preventing concurrent syncbacks. - Enhanced error handling in the API syncback process to return a conflict response if a syncback is already in progress. - Improved the `serve.rs` file by replacing `forget` with `drop` for better memory management and added checks to ensure service chunk integrity during live syncback operations. - Added new tests for edge cases and resilience in live syncback functionality, ensuring robustness against malformed data and rapid sequential requests. These changes aim to enhance the reliability and performance of the syncback feature while keeping dependencies up to date.
This commit is contained in:
parent
69f0b9fd63
commit
5b38648ead
12 changed files with 387 additions and 117 deletions
|
|
@ -256,7 +256,12 @@ async fn handle_api_syncback(
|
|||
data: syncback_request.data,
|
||||
services: syncback_request.services,
|
||||
};
|
||||
syncback_signal.fire(payload);
|
||||
if !syncback_signal.fire(payload) {
|
||||
return msgpack(
|
||||
ErrorResponse::bad_request("A syncback is already in progress"),
|
||||
StatusCode::CONFLICT,
|
||||
);
|
||||
}
|
||||
|
||||
msgpack_ok(serde_json::json!({"status": "syncback_initiated"}))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ pub const PROTOCOL_VERSION: u64 = 6;
|
|||
|
||||
/// Metadata for a single service in the live syncback request.
|
||||
///
|
||||
/// Children are NOT stored here — they live in the top-level `data` blob
|
||||
/// Children are NOT stored here -- they live in the top-level `data` blob
|
||||
/// (a single rbxm containing all children from all services).
|
||||
///
|
||||
/// Each service's range in the blob is `child_count + ref_target_count`
|
||||
|
|
@ -37,10 +37,9 @@ pub const PROTOCOL_VERSION: u64 = 6;
|
|||
/// to the service). The next `ref_target_count` are ObjectValue carriers
|
||||
/// whose `Value` property holds a Ref to the actual target.
|
||||
///
|
||||
/// `refs` maps property names to 1-based indices into the carrier slice
|
||||
/// (the ObjectValue entries after the children). Index 1 is the first
|
||||
/// carrier, 2 the second, etc. The server reads carriers via
|
||||
/// `carriers[idx - 1]`.
|
||||
/// `refs` maps property names to 1-based indices into the carrier subrange
|
||||
/// (NOT the full service range). Index 1 = first carrier, index 2 = second,
|
||||
/// etc. Index 0 or out-of-range values are ignored (treated as nil).
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ServiceChunk {
|
||||
|
|
|
|||
|
|
@ -40,9 +40,14 @@ impl SyncbackSignal {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn fire(&self, payload: SyncbackPayload) {
|
||||
*self.payload.lock().unwrap_or_else(|e| e.into_inner()) = Some(payload);
|
||||
pub fn fire(&self, payload: SyncbackPayload) -> bool {
|
||||
let mut guard = self.payload.lock().unwrap_or_else(|e| e.into_inner());
|
||||
if guard.is_some() {
|
||||
return false;
|
||||
}
|
||||
*guard = Some(payload);
|
||||
self.notify.notify_one();
|
||||
true
|
||||
}
|
||||
|
||||
pub fn take_payload(&self) -> Option<SyncbackPayload> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue