mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-24 06:34:09 +00:00
Refactor ServeSession to support oneshot sessions
- Updated the ServeSession struct to allow for optional ChangeProcessor and related fields, enabling lightweight oneshot sessions that do not require live filesystem monitoring. - Modified the new and new_oneshot methods to initialize sessions accordingly, improving flexibility for commands that only need a snapshot of the tree. - Adjusted related CLI commands to utilize the new oneshot session functionality, enhancing performance for operations like plugin installation and syncback. These changes streamline session management and improve the efficiency of operations that do not require continuous updates.
This commit is contained in:
parent
431b1fb5a5
commit
484b190464
4 changed files with 81 additions and 33 deletions
|
|
@ -55,7 +55,7 @@ fn initialize_plugin() -> anyhow::Result<ServeSession> {
|
|||
in_memory_fs.load_snapshot("/plugin", plugin_snapshot)?;
|
||||
|
||||
let vfs = Vfs::new(in_memory_fs);
|
||||
Ok(ServeSession::new(vfs, "/plugin", None)?)
|
||||
Ok(ServeSession::new_oneshot(vfs, "/plugin")?)
|
||||
}
|
||||
|
||||
fn install_plugin() -> anyhow::Result<()> {
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ impl SyncbackCommand {
|
|||
let vfs = Vfs::new_oneshot();
|
||||
|
||||
let project_start_timer = Instant::now();
|
||||
let session_old = ServeSession::new(vfs, path_old.clone(), None)?;
|
||||
let session_old = ServeSession::new_oneshot(vfs, path_old.clone())?;
|
||||
log::debug!(
|
||||
"Finished opening project in {:0.02}s",
|
||||
project_start_timer.elapsed().as_secs_f32()
|
||||
|
|
@ -251,7 +251,7 @@ impl SyncbackCommand {
|
|||
// cases, we log a warning but don't fail the syncback.
|
||||
let sourcemap_path = base_path.join("sourcemap.json");
|
||||
let sourcemap_vfs = Vfs::new_oneshot();
|
||||
match ServeSession::new(sourcemap_vfs, path_old.clone(), None) {
|
||||
match ServeSession::new_oneshot(sourcemap_vfs, path_old.clone()) {
|
||||
Ok(sourcemap_session) => {
|
||||
write_sourcemap(
|
||||
&sourcemap_session,
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ impl UploadCommand {
|
|||
|
||||
let vfs = Vfs::new_default();
|
||||
|
||||
let session = ServeSession::new(vfs, project_path, None)?;
|
||||
let session = ServeSession::new_oneshot(vfs, project_path)?;
|
||||
|
||||
let tree = session.tree();
|
||||
let inner_tree = tree.inner();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue