diff options
| author | Marwan Sulaiman <marwan@tailscale.com> | 2023-05-25 13:52:41 -0400 |
|---|---|---|
| committer | Marwan Sulaiman <marwan@tailscale.com> | 2023-05-25 13:52:41 -0400 |
| commit | fb13df273a2450ea6f60414d24519cc53a1e79d6 (patch) | |
| tree | 75cd6b974c14468910876bd8d415d783340a71f2 | |
| parent | bfda03465502d24fb79b50a7d6b90a1377e2aaf1 (diff) | |
| download | tailscale-marwan/portlistrefactor.tar.xz tailscale-marwan/portlistrefactor.zip | |
Ensure ticker stopmarwan/portlistrefactor
| -rw-r--r-- | portlist/poller.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/portlist/poller.go b/portlist/poller.go index d7bea2777..51e8f9294 100644 --- a/portlist/poller.go +++ b/portlist/poller.go @@ -169,8 +169,10 @@ func (p *Poller) Run(ctx context.Context) (chan Update, error) { return nil, fmt.Errorf("error initializing poller: %w", p.initErr) } tick := time.NewTicker(p.Interval) - defer tick.Stop() - go p.runWithTickChan(ctx, tick.C) + go func() { + defer tick.Stop() + p.runWithTickChan(ctx, tick.C) + }() return p.c, nil } |
