Skip to content

Commit

Permalink
Fix overwriting state with undefined on exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
voltrevo committed Feb 29, 2024
1 parent add823c commit b6baaf7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions vstc/src/db_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,12 @@ impl Handler<DbRequest> for DbActor {
}
};

self
.storage
.set_head(storage_head_ptr(b"state"), &instance)
.unwrap();
if res.is_ok() {
self
.storage
.set_head(storage_head_ptr(b"state"), &instance)
.unwrap();
}

// TODO: Consider more cache retention
self.storage.clear_read_cache();
Expand Down

0 comments on commit b6baaf7

Please sign in to comment.