aboutsummaryrefslogtreecommitdiff
path: root/pkg/atlas
diff options
context:
space:
mode:
authorpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-22 12:36:28 -0400
committerpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-22 12:36:28 -0400
commit83bf5336da7a80cd832b7d9b30d5e010e0db6dfd (patch)
tree164a7dfd51d39bc96369eb71abb018441a6dbd6e /pkg/atlas
parent0cec719bf38ce61f9176b2cf5094c5e7e8f0529b (diff)
downloadAtlas-83bf5336da7a80cd832b7d9b30d5e010e0db6dfd.tar.gz
Atlas-83bf5336da7a80cd832b7d9b30d5e010e0db6dfd.zip
pkg/atlas: Reap dead servers periodically
Diffstat (limited to 'pkg/atlas')
-rw-r--r--pkg/atlas/server.go14
1 files changed, 14 insertions, 0 deletions
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{