Skip to content

Commit

Permalink
change to single go routine
Browse files Browse the repository at this point in the history
  • Loading branch information
fredcarle committed Jul 1, 2024
1 parent 0686be2 commit ab6f897
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/db/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,15 @@ func (db *db) handleMessages(ctx context.Context, sub *event.Subscription) {
case event.PeerInfo:
db.peerInfo.Store(evt.Info)
// Load and publish P2P collections and replicators once per db instance start.
// Go routines are used to ensure the message handler is not blocked by these potentially
// A Go routine is used to ensure the message handler is not blocked by these potentially
// long running operations.
go onceP2PCollection.Do(func() {
err := db.loadAndPublishP2PCollections(ctx)
if err != nil {
log.ErrorContextE(ctx, "Failed to load P2P collections", err)
}
})
go onceReps.Do(func() {
err := db.loadAndPublishReplicators(ctx)

err = db.loadAndPublishReplicators(ctx)
if err != nil {
log.ErrorContextE(ctx, "Failed to load replicators", err)
}
Expand Down

0 comments on commit ab6f897

Please sign in to comment.