Skip to content

Comments

Optimize web interface performance and async safety#197

Open
Cylae wants to merge 1 commit intomainfrom
check-fix-optimize-16168826496189565349
Open

Optimize web interface performance and async safety#197
Cylae wants to merge 1 commit intomainfrom
check-fix-optimize-16168826496189565349

Conversation

@Cylae
Copy link
Owner

@Cylae Cylae commented Feb 17, 2026

This PR addresses performance bottlenecks and potential async runtime blocking issues in the Server Manager web interface.

Key changes:

  1. Async User Management: Added add_user_async and delete_user_async to UserManager. These methods handle file I/O (updating users.yaml) and system calls (creating/deleting Linux users) within tokio::task::spawn_blocking, preventing the async executor from stalling during these operations.
  2. Optimized Dashboard: The dashboard handler previously performed synchronous system hardware refreshes (refresh_cpu, refresh_memory, refresh_disks) while holding a Mutex on the main async thread. This has been moved to spawn_blocking.
  3. Startup Optimization: sysinfo::System::new_all() is a heavy operation. It is now offloaded to a blocking task during server startup.
  4. Safety: Replaced unwrap() calls on std::sync::Mutex locks with expect() for better error reporting (though poisoning still panics, as is standard).
  5. Version Bump: Updated project version to 1.0.8 to reflect these improvements.

Verified with cargo check, cargo test, and cargo clippy.


PR created automatically by Jules for task 16168826496189565349 started by @Cylae

…gement

- Implemented `add_user_async` and `delete_user_async` in `UserManager` to offload blocking I/O and system calls to `tokio::task::spawn_blocking`.
- Optimized `start_server` to initialize `sysinfo::System` in a blocking task, preventing async runtime stalls during startup.
- Refactored `dashboard` handler to perform system resource refreshes (CPU, RAM, Disks) in a blocking task, ensuring responsiveness even under load.
- Replaced potential panics (`unwrap`) on Mutex locks with safer `expect` calls.
- Bumped version to 1.0.8 in `Cargo.toml` and `README.md`.
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant