Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Commit

Permalink
bump version when something changes: better for shared vaults
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Cheong committed Aug 27, 2023
1 parent 81d1049 commit 9b94870
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/handlers/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func WsHandler(c *gin.Context) {
}

}
var version_bumped bool = false
ws.WriteJSON(gin.H{"op": "ready", "version": connectedVault.Version})

defer vault.Snapshot(connectedVault.ID)
Expand Down Expand Up @@ -244,6 +245,10 @@ func WsHandler(c *gin.Context) {
metadata.UID = int(vaultUID)
// Broadcast to all clients
channels[connectedVault.ID].Broadcast(metadata)
if !version_bumped {
dbConnection.SetVaultVersion(connectedVault.ID, version+1)
version_bumped = true
}
ws.WriteJSON(gin.H{"op": "ok"})
case "history":
var history struct {
Expand Down

0 comments on commit 9b94870

Please sign in to comment.