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

Fix issue #22 #30

Merged
merged 3 commits into from
Jun 21, 2022
Merged

Fix issue #22 #30

merged 3 commits into from
Jun 21, 2022

Conversation

jack-ullery
Copy link
Owner

Description of issue

Previously, we had an issue where the Logs tab would freeze when loading it for the first time. This would happen, because it takes a long time to read and parse a large number of logs.

How the issue was solved

I changes how LogsController parses logs. Previously, it parsed all the logs in one long for-loop. Now, it parses the logs in batches of 128 logs.

When the add_data_to_record(..)) method is called, it creates an idle function to parse logs when nothing else is happening. This means that, whenever the application is in use (for example if the user is clicking buttons), the idle function waits to be called. Eventually, when the function is finally called: it only parses 128 logs, and waits until the main loop is ready to call it again.

What this means

Now the Logs tab can be populated without freezing the application.

Any lingering issues

I did some research into using cursors, to control which logs journalctl reads. Cursors can be read directly from a log's json value. I think this approach could be helpful when refreshing the tab to look for more logs. It would be better to only look for logs after the most recent cursor, in addition to the changes made in this PR.

This allows the user to interact with the application while logs are loading. Currently there seems to be a memory leak when the application exits before the logs are finished parsing.
@jack-ullery jack-ullery merged commit ec5292b into main Jun 21, 2022
@jack-ullery jack-ullery linked an issue Jul 3, 2022 that may be closed by this pull request
@jack-ullery jack-ullery deleted the issue-22 branch September 22, 2023 19:58
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.

Long load times for logs
1 participant