Fix notifiable when creating sync tree

This commit is contained in:
mcrakhman 2022-12-05 17:21:14 +01:00 committed by Mikhail Iudin
parent c5b766345c
commit 00b1b8e4a5
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0
2 changed files with 7 additions and 1 deletions

View File

@ -108,7 +108,7 @@ func (s *space) LastUsage() time.Time {
}
func (s *space) Locked() bool {
log.With(zap.Bool("locked", s.treesUsed.Load() > 1)).Debug("space lock status check")
log.With(zap.Int32("trees used", s.treesUsed.Load())).Debug("space lock status check")
return s.treesUsed.Load() > 1
}

View File

@ -100,6 +100,9 @@ func DeriveSyncTree(ctx context.Context, deps CreateDeps) (t SyncTree, err error
syncTree.listener.Rebuild(syncTree)
}
syncTree.treeUsage.Add(1)
if syncTree.notifiable != nil {
syncTree.notifiable.UpdateHeads(objTree.ID(), objTree.Heads())
}
headUpdate := syncClient.CreateHeadUpdate(t, nil)
err = syncClient.BroadcastAsync(headUpdate)
@ -133,6 +136,9 @@ func CreateSyncTree(ctx context.Context, deps CreateDeps) (t SyncTree, err error
syncTree.listener.Rebuild(syncTree)
}
syncTree.treeUsage.Add(1)
if syncTree.notifiable != nil {
syncTree.notifiable.UpdateHeads(objTree.ID(), objTree.Heads())
}
headUpdate := syncClient.CreateHeadUpdate(t, nil)
err = syncClient.BroadcastAsync(headUpdate)