fix nodes online

This commit is contained in:
mcrakhman 2023-06-28 17:35:45 +02:00
parent 3f08fcb555
commit e5b4f62e48
No known key found for this signature in database
GPG Key ID: DED12CFEF5B8396B

View File

@ -3,11 +3,12 @@ package syncstatus
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/anyproto/any-sync/app"
"github.com/anyproto/any-sync/commonspace/spacestate"
"sync" "sync"
"time" "time"
"github.com/anyproto/any-sync/app"
"github.com/anyproto/any-sync/commonspace/spacestate"
"github.com/anyproto/any-sync/app/logger" "github.com/anyproto/any-sync/app/logger"
"github.com/anyproto/any-sync/commonspace/object/tree/treestorage" "github.com/anyproto/any-sync/commonspace/object/tree/treestorage"
"github.com/anyproto/any-sync/commonspace/spacestorage" "github.com/anyproto/any-sync/commonspace/spacestorage"
@ -178,8 +179,9 @@ func (s *syncStatusService) update(ctx context.Context) (err error) {
} }
s.treeStatusBuf = append(s.treeStatusBuf, treeStatus{treeId, treeHeads.syncStatus, treeHeads.heads}) s.treeStatusBuf = append(s.treeStatusBuf, treeStatus{treeId, treeHeads.syncStatus, treeHeads.heads})
} }
nodesOnline := s.nodesOnline
s.Unlock() s.Unlock()
s.updateReceiver.UpdateNodeConnection(s.nodesOnline) s.updateReceiver.UpdateNodeConnection(nodesOnline)
for _, entry := range s.treeStatusBuf { for _, entry := range s.treeStatusBuf {
err = s.updateReceiver.UpdateTree(ctx, entry.treeId, entry.status) err = s.updateReceiver.UpdateTree(ctx, entry.treeId, entry.status)
if err != nil { if err != nil {