Skip to content

Commit

Permalink
Merge pull request #4402 from systeminit/jhelwig/read-lock-write-race
Browse files Browse the repository at this point in the history
Address read-lock-write race condition in WorkspaceSnapshot::revert
  • Loading branch information
jhelwig authored Aug 22, 2024
2 parents bd62702 + 314fd9e commit 868ad97
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/dal/src/workspace_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,9 @@ impl WorkspaceSnapshot {
/// Discard all changes in the working copy and return the graph to the
/// version fetched from the layer db
pub async fn revert(&self) {
if self.working_copy.read().await.is_some() {
*self.working_copy.write().await = None
let mut working_copy = self.working_copy.write().await;
if working_copy.is_some() {
*working_copy = None;
}
}

Expand Down

0 comments on commit 868ad97

Please sign in to comment.