From 83bf5336da7a80cd832b7d9b30d5e010e0db6dfd Mon Sep 17 00:00:00 2001 From: pg9182 <96569817+pg9182@users.noreply.github.com> Date: Sat, 22 Oct 2022 12:36:28 -0400 Subject: pkg/atlas: Reap dead servers periodically --- pkg/atlas/server.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'pkg/atlas') diff --git a/pkg/atlas/server.go b/pkg/atlas/server.go index c65aeb7..821d093 100644 --- a/pkg/atlas/server.go +++ b/pkg/atlas/server.go @@ -538,6 +538,20 @@ func (s *Server) Run(ctx context.Context) error { return http.ErrServerClosed } + go func() { + tk := time.NewTicker(time.Minute * 5) + defer tk.Stop() + + for { + select { + case <-ctx.Done(): + return + case <-tk.C: + s.API0.ServerList.ReapServers() + } + } + }() + var hs []*http.Server for _, a := range s.Addr { hs = append(hs, &http.Server{ -- cgit v1.2.3