-
Notifications
You must be signed in to change notification settings - Fork 415
feat(notification): Spawn event notification in a separate task #871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The changes in this commit improve the handling of event notifications in the application. Previously, the event notification was started synchronously, which could potentially block the main application thread. The changes now spawn the event notification in a separate task using Tauri's async runtime, allowing the main application to continue running without being blocked. This change ensures a more responsive and efficient application, as the event notification can run in the background without impacting the main application flow.
WalkthroughThe event notification initialization logic was updated from a synchronous, blocking approach to an asynchronous, non-blocking model. The code now spawns a background task to handle event notification startup, allowing setup to proceed without waiting for completion. Error logging is performed within the spawned task. Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant NotificationPlugin
participant AsyncTask
App->>NotificationPlugin: Initialize plugin
NotificationPlugin->>AsyncTask: Spawn async task for event notification
AsyncTask->>NotificationPlugin: Await start_event_notification()
AsyncTask->>AsyncTask: Log errors if any
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🔇 Additional comments (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@yujonglee I think this might fix #870 . Could you take a look into this? |
What was happening
plugin::Builder::setup()executes inside the app-wide Tokio runtime that Tauri starts for you.setupby doingHandle::current().block_on()starts a second runtime and blocks the current thread until the future finishes. Tokio forbids nesting a runtime inside another running runtime – it would dead-lock the executor.Cannot start a runtime from within a runtime, aborting the process during startup for any user who had Event Notifications enabled.Why the patch fixes it
tauri::async_runtime::spawnschedules the future on the existing executor instead of blocking.start_event_notificationfails we just log the error instead of panicking.Summary by CodeRabbit