Skip to content

fix: avoid deleting peers on graceful close #14165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 14, 2024
Prev Previous commit
wrong ctx
  • Loading branch information
sreya committed Aug 14, 2024
commit 8a65a2f3465314d9b44ec98242f0c7d59a7fd9f8
4 changes: 2 additions & 2 deletions enterprise/tailnet/pgcoord.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,14 @@ func newBinder(ctx context.Context,

go func() {
defer close(b.close)
<-ctx.Done()
<-b.ctx.Done()
b.logger.Debug(b.ctx, "binder exiting, waiting for workers")

b.workerWG.Wait()

b.logger.Debug(b.ctx, "updating peers to lost")

ctx, cancel := context.WithTimeout(ctx, time.Second*15)
ctx, cancel := context.WithTimeout(context.Background(), time.Second*15)
defer cancel()
err := b.store.UpdateTailnetPeerStatusByCoordinator(ctx, database.UpdateTailnetPeerStatusByCoordinatorParams{
CoordinatorID: b.coordinatorID,
Expand Down
Loading