Skip to content

[Refactor] Move FSAL cache to async#5994

Merged
nathanlesage merged 5 commits into
Zettlr:developfrom
benniekiss:fsal-cache
Jan 13, 2026
Merged

[Refactor] Move FSAL cache to async#5994
nathanlesage merged 5 commits into
Zettlr:developfrom
benniekiss:fsal-cache

Conversation

@benniekiss

@benniekiss benniekiss commented Nov 5, 2025

Copy link
Copy Markdown
Collaborator

Description

This PR moves the FSAL cache code to async functions.

Changes

The FSAL cache code was migrated to use async functions.

A couple of external functions which use the FSAL cache were updated to match the new async pattern.

Additional information

The main motivation was to take advantage of async readFile and lstat. In my tests loading a large workspace, the time went from 89 seconds to 3 seconds to load.

EDIT: The claim in speed improvements may be erroneous, as after a few restarts on the develop branch, I no longer experienced the same long load times that led me down this path. Both implementations provide approximately the same performance, in my small amount of testing.

Async is not my strong suit, so I may have missed something in the port!

Tested on: macOS 26

@nathanlesage nathanlesage left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Found a few possibly problematic things, but other than that I can't see too many things bad about this!

Comment thread source/app/service-providers/fsal/fsal-cache.ts
Comment thread source/app/service-providers/fsal/fsal-code-file.ts Outdated
Comment thread source/app/service-providers/fsal/index.ts Outdated

@nathanlesage nathanlesage left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've now seen what you mean with making the emitChokidarEvent function async, but unfortunately that won't work as expected :/

I think, simply keeping the catch-handlers and logging any errors is the most suitable approach here.

Comment thread source/app/service-providers/fsal/index.ts Outdated
@benniekiss

Copy link
Copy Markdown
Collaborator Author

This is good to go on my end!

@nathanlesage

Copy link
Copy Markdown
Member

Looks good! Let's go with it!

@nathanlesage nathanlesage merged commit f4c0662 into Zettlr:develop Jan 13, 2026
1 check passed
@benniekiss benniekiss deleted the fsal-cache branch January 13, 2026 18:18
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