Add sync listener nil check
This commit is contained in:
parent
d23f36d364
commit
f5a2a7a959
@ -83,7 +83,9 @@ func DeriveSyncTree(ctx context.Context, deps CreateDeps) (t tree.ObjectTree, er
|
|||||||
t = syncTree
|
t = syncTree
|
||||||
syncTree.Lock()
|
syncTree.Lock()
|
||||||
defer syncTree.Unlock()
|
defer syncTree.Unlock()
|
||||||
syncTree.listener.Rebuild(syncTree)
|
if syncTree.listener != nil {
|
||||||
|
syncTree.listener.Rebuild(syncTree)
|
||||||
|
}
|
||||||
|
|
||||||
headUpdate := syncClient.CreateHeadUpdate(t, nil)
|
headUpdate := syncClient.CreateHeadUpdate(t, nil)
|
||||||
err = syncClient.BroadcastAsync(headUpdate)
|
err = syncClient.BroadcastAsync(headUpdate)
|
||||||
@ -111,7 +113,10 @@ func CreateSyncTree(ctx context.Context, deps CreateDeps) (t tree.ObjectTree, er
|
|||||||
t = syncTree
|
t = syncTree
|
||||||
syncTree.Lock()
|
syncTree.Lock()
|
||||||
defer syncTree.Unlock()
|
defer syncTree.Unlock()
|
||||||
syncTree.listener.Rebuild(syncTree)
|
// TODO: refactor here because the code is duplicated, when we create a tree we should only create a storage and then build a tree
|
||||||
|
if syncTree.listener != nil {
|
||||||
|
syncTree.listener.Rebuild(syncTree)
|
||||||
|
}
|
||||||
|
|
||||||
headUpdate := syncClient.CreateHeadUpdate(t, nil)
|
headUpdate := syncClient.CreateHeadUpdate(t, nil)
|
||||||
err = syncClient.BroadcastAsync(headUpdate)
|
err = syncClient.BroadcastAsync(headUpdate)
|
||||||
@ -203,7 +208,9 @@ func buildSyncTree(ctx context.Context, isFirstBuild bool, deps BuildDeps) (t tr
|
|||||||
t = syncTree
|
t = syncTree
|
||||||
syncTree.Lock()
|
syncTree.Lock()
|
||||||
defer syncTree.Unlock()
|
defer syncTree.Unlock()
|
||||||
syncTree.listener.Rebuild(syncTree)
|
if syncTree.listener != nil {
|
||||||
|
syncTree.listener.Rebuild(syncTree)
|
||||||
|
}
|
||||||
|
|
||||||
headUpdate := syncTree.syncClient.CreateHeadUpdate(t, nil)
|
headUpdate := syncTree.syncClient.CreateHeadUpdate(t, nil)
|
||||||
// here we will have different behaviour based on who is sending this update
|
// here we will have different behaviour based on who is sending this update
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user