This repository has been archived by the owner on Aug 3, 2023. It is now read-only.
[dev] fix: properly route to new preview id after reload #1117
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1082 and might fix #1107
We keep
preview_id
in anArc<Mutex
so that when a reload is detected on another thread, the dev server can properly route new requests to the new preview_id. Previously, the server would only attempt to acquire the lock every couple of minutes. After moving the lock acquisition toservice_fn
frommake_service_fn
, the lock is acquired on every request, making sure that each request is going to the right version of the script.