mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Refactor syncback process and improve code readability
- Reformatted the `SYNCBACK_SERVICES` list for better readability by aligning entries vertically. - Simplified the `performSyncback` function by removing unnecessary Promise wrapping, enhancing clarity and maintainability. - Updated the `NotConnectedPage` component to improve the structure of button elements and their associated tooltips. - Refactored the `hydrate` and `matching` modules to streamline function calls and improve code organization. These changes enhance the overall readability and maintainability of the syncback process and related components.
This commit is contained in:
parent
372a422b3d
commit
93ea0bdef6
16 changed files with 546 additions and 375 deletions
|
|
@ -29,9 +29,9 @@ use crate::{
|
|||
web::{
|
||||
interface::{
|
||||
ErrorResponse, Instance, InstanceMetadata, MessagesPacket, OpenResponse, ReadResponse,
|
||||
ServerInfoResponse, SocketPacket, SocketPacketBody, SocketPacketType,
|
||||
SubscribeMessage, SyncbackPayload, SyncbackRequest, WriteRequest, WriteResponse,
|
||||
PROTOCOL_VERSION, SERVER_VERSION,
|
||||
ServerInfoResponse, SocketPacket, SocketPacketBody, SocketPacketType, SubscribeMessage,
|
||||
SyncbackPayload, SyncbackRequest, WriteRequest, WriteResponse, PROTOCOL_VERSION,
|
||||
SERVER_VERSION,
|
||||
},
|
||||
util::{deserialize_msgpack, msgpack, msgpack_ok, serialize_msgpack},
|
||||
},
|
||||
|
|
@ -256,7 +256,7 @@ async fn handle_api_syncback(
|
|||
};
|
||||
syncback_signal.fire(payload);
|
||||
|
||||
msgpack_ok(&serde_json::json!({"status": "syncback_initiated"}))
|
||||
msgpack_ok(serde_json::json!({"status": "syncback_initiated"}))
|
||||
}
|
||||
|
||||
pub struct ApiService {
|
||||
|
|
|
|||
|
|
@ -41,12 +41,15 @@ impl SyncbackSignal {
|
|||
}
|
||||
|
||||
pub fn fire(&self, payload: SyncbackPayload) {
|
||||
*self.payload.lock().unwrap() = Some(payload);
|
||||
*self.payload.lock().unwrap_or_else(|e| e.into_inner()) = Some(payload);
|
||||
self.notify.notify_one();
|
||||
}
|
||||
|
||||
pub fn take_payload(&self) -> Option<SyncbackPayload> {
|
||||
self.payload.lock().unwrap().take()
|
||||
self.payload
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner())
|
||||
.take()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue