Skip to content
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

Clear History via isolate #551

Open
ashitaprasad opened this issue Jan 25, 2025 · 2 comments
Open

Clear History via isolate #551

ashitaprasad opened this issue Jan 25, 2025 · 2 comments
Labels
enhancement New feature or request FOSSHack2025

Comments

@ashitaprasad
Copy link
Member

ashitaprasad commented Jan 25, 2025

Currently, history data which has crossed the retention date is cleared in the main thread. Optimize the code to clear it using isolates.

@ashitaprasad ashitaprasad added enhancement New feature or request FOSSHack2025 labels Jan 25, 2025
@abhinavs1920
Copy link

To optimize clearing history data using isolates, we need to focus on offloading this task from the main thread to improve performance and responsiveness.

The first step is identifying where the history clearing logic currently resides, likely within a model or service related to history management. Once located, we should extract this logic into a standalone function that can be executed in an isolate.

Next, we utilize Dart's isolate capabilities, specifically the Isolate.spawn function, to run this clearing function in a separate thread. This involves setting up a ReceivePort to facilitate communication between the main thread and the isolate, allowing us to receive confirmation once the clearing operation is complete. The data necessary for the clearing process, such as references to the history storage or criteria for identifying outdated entries, should be prepared and passed to the isolate.

After implementing the isolate-based clearing function, we integrate it into the existing history management logic, replacing any direct clearing operations on the main thread. This ensures that the application remains responsive, even when handling large volumes of history data.

Please let me know if the approach is good enough.

@ashitaprasad
Copy link
Member Author

@abhinavs1920 You can share across a draft PR highlighting your approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request FOSSHack2025
Projects
None yet
Development

No branches or pull requests

2 participants