Skip to content

fix: use spawn_blocking for file access during async context#1936

Merged
ellie merged 1 commit into
mainfrom
file-blocking-update-check
Apr 12, 2024
Merged

fix: use spawn_blocking for file access during async context#1936
ellie merged 1 commit into
mainfrom
file-blocking-update-check

Conversation

@conradludgate
Copy link
Copy Markdown
Collaborator

Context:
update checking runs asynchronously to allow DB and UI rendering to occur concurrently with the otherwise superficial update check system.

The file accesses that take place during this check run synchronously on the main thread and can block the runtime from running the render routine. I wouldn't expect the file accesses to take long but filesystems can be weird I guess?

(extra context, tokio::fs::File also does spawn_blocking, so I would stick with fs-err here for the better error messages and not use tokio::fs)

Checks

  • I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle
  • I have checked that there are no existing pull requests for the same thing

@ellie
Copy link
Copy Markdown
Member

ellie commented Apr 12, 2024

is this ready for review? (still a draft)

@conradludgate conradludgate marked this pull request as ready for review April 12, 2024 09:20
@conradludgate
Copy link
Copy Markdown
Collaborator Author

conradludgate commented Apr 12, 2024

I was planning to shuffle around when the db queries happen too, relative to rendering, but I can do that separately

Copy link
Copy Markdown
Member

@ellie ellie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty 🚀

@ellie ellie merged commit c41998e into main Apr 12, 2024
@ellie ellie deleted the file-blocking-update-check branch April 12, 2024 09:40
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.

2 participants