-
Notifications
You must be signed in to change notification settings - Fork 4
/
impl.go
39 lines (35 loc) · 895 Bytes
/
impl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package httpd
import (
"time"
dnslbcfg "github.com/Cloud-Foundations/golib/pkg/loadbalancing/dnslb/config"
"github.com/Cloud-Foundations/golib/pkg/watchdog"
)
func (s *Server) performStateCleanup(secsBetweenCleanup int) {
for {
s.cookieMutex.Lock()
for key, authCookie := range s.authCookie {
if authCookie.ExpiresAt.Before(time.Now()) {
delete(s.authCookie, key)
}
}
s.cookieMutex.Unlock()
time.Sleep(time.Duration(secsBetweenCleanup) * time.Second)
}
}
func (s *Server) setupHA() error {
if hasDnsLB, err := s.staticConfig.DnsLoadBalancer.Check(); err != nil {
return err
} else if hasDnsLB {
_, err := dnslbcfg.New(s.staticConfig.DnsLoadBalancer, s.logger)
if err != nil {
return err
}
}
if s.staticConfig.Watchdog.CheckInterval > 0 {
_, err := watchdog.New(s.staticConfig.Watchdog, s.logger)
if err != nil {
return err
}
}
return nil
}