Add some comments and checks
This commit is contained in:
parent
fb6476939e
commit
bc857efc6c
@ -112,6 +112,8 @@ func (s *service) NewSpace(ctx context.Context, id string) (Space, error) {
|
|||||||
|
|
||||||
var statusService statusservice.StatusService
|
var statusService statusservice.StatusService
|
||||||
// this will work only for clients, not the best solution, but...
|
// this will work only for clients, not the best solution, but...
|
||||||
|
// TODO: maybe change this to dependency injection where we would inject the method `ProvideStatusService`
|
||||||
|
// and for nodes there would be NoOpStatusService
|
||||||
if !lastConfiguration.IsResponsible(st.Id()) {
|
if !lastConfiguration.IsResponsible(st.Id()) {
|
||||||
statusService = statusservice.NewStatusService(st.Id(), lastConfiguration)
|
statusService = statusservice.NewStatusService(st.Id(), lastConfiguration)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,7 +101,10 @@ func DeriveSyncTree(ctx context.Context, deps CreateDeps) (id string, err error)
|
|||||||
deps.Configuration)
|
deps.Configuration)
|
||||||
|
|
||||||
headUpdate := syncClient.CreateHeadUpdate(objTree, nil)
|
headUpdate := syncClient.CreateHeadUpdate(objTree, nil)
|
||||||
deps.StatusService.HeadsChange(objTree.ID(), objTree.Heads())
|
if deps.StatusService != nil {
|
||||||
|
// TODO: maybe change to no-op status service
|
||||||
|
deps.StatusService.HeadsChange(objTree.ID(), objTree.Heads())
|
||||||
|
}
|
||||||
syncClient.BroadcastAsync(headUpdate)
|
syncClient.BroadcastAsync(headUpdate)
|
||||||
id = objTree.ID()
|
id = objTree.ID()
|
||||||
return
|
return
|
||||||
@ -119,7 +122,10 @@ func CreateSyncTree(ctx context.Context, deps CreateDeps) (id string, err error)
|
|||||||
deps.Configuration)
|
deps.Configuration)
|
||||||
|
|
||||||
headUpdate := syncClient.CreateHeadUpdate(objTree, nil)
|
headUpdate := syncClient.CreateHeadUpdate(objTree, nil)
|
||||||
deps.StatusService.HeadsChange(objTree.ID(), objTree.Heads())
|
|
||||||
|
if deps.StatusService != nil {
|
||||||
|
deps.StatusService.HeadsChange(objTree.ID(), objTree.Heads())
|
||||||
|
}
|
||||||
syncClient.BroadcastAsync(headUpdate)
|
syncClient.BroadcastAsync(headUpdate)
|
||||||
id = objTree.ID()
|
id = objTree.ID()
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user