Skip to content

Commit

Permalink
chore: add tiemout to findpeers (#569)
Browse files Browse the repository at this point in the history
Signed-off-by: mudler <mudler@localai.io>
  • Loading branch information
mudler authored Aug 27, 2024
1 parent d394cd6 commit 418f7c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/discovery/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ func (d *DHT) announceAndConnect(l log.StandardLogger, ctx context.Context, kade
// This is like your friend telling you the location to meet you.
l.Debug("Searching for other peers...")

peerChan, err := routingDiscovery.FindPeers(ctx, rv)
fCtx, cf := context.WithTimeout(ctx, time.Second*120)
defer cf()
peerChan, err := routingDiscovery.FindPeers(fCtx, rv)
if err != nil {
return err
}
Expand Down

0 comments on commit 418f7c6

Please sign in to comment.