-
Notifications
You must be signed in to change notification settings - Fork 4
Cache Reference Directories #18
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
Cache Reference Directories #18
Conversation
let current_files = &self | ||
.shared_state | ||
.compilation_state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a race condition here. Another thread could perform a compilation or anything else affecting the compilation_state between caching the current files and performing the compilation.
Maybe open an issue unless you want to fix it here since it's somewhat related.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@externl, just to be clear, are you talking about this case?:
THREAD 1 THREAD 2
update_config
.
. trigger_compilation
.
trigger_compilation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more specifically
THREAD 1 THREAD 2
modify_state|copy_from_state
.
. trigger_compilation
.
trigger_compilation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
611ad4f
to
28c67da
Compare
Our current logic is as follows:
Whenever a user changes a file, we trigger a compilation:
root_uri
to aroot_path
root_path
)SharedState
.This PR makes the following improvements:
root_uri
at initialization, and the only thing we do with it is convert it into aroot_path
. Now, we do this conversion once, on server start-up, and store theroot_path
instead ofroot_uri
.Now, whenever the config changes, we update the references and cache them up-front.
SliceConfig
, and once inSliceOptions
. These are redundant.Now we store the
SliceOptions
directly inSliceConfig
. Since the SliceOptions only depends on the config. Nothing else.SharedState
only holds aCompilationState
. So there's no reason to haveSharedState
anymore. We just hold theCompilationState
directly.