still builds
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-03-27 16:46:47 -07:00
parent 0683cd7b32
commit 84b19fb14e
3 changed files with 19 additions and 10 deletions

View File

@@ -11,16 +11,17 @@ import (
"github.com/spf13/viper"
)
//import "github.com/gin-gonic/gin"
// LogReportInterval defines how long between logging internal
// stats/reporting for user supervision
var LogReportInterval = time.Second * 10
// conform for storing toots
type DatabaseStorage interface {
ListInstances() ([]*instance.Instance, error)
StoreInstances([]*instance.Instance) error
}
// InstanceManager is the main data structure for the goroutine that manages
// the list of all known instances, fed by the locator
type InstanceManager struct {
mu sync.Mutex
db DatabaseStorage
instances map[instance.Hostname]*instance.Instance
newInstanceNotifications chan instance.Hostname
tootDestination chan *toot.Toot
@@ -89,7 +90,7 @@ func (im *InstanceManager) Manage() {
log.Info().Msg("InstanceManager tick")
im.managerLoop()
time.Sleep(1 * time.Second)
if time.Now().After(x.Add(LogReportInterval)) {
if time.Now().After(x.Add(viper.GetDuration("LogReportInterval"))) {
x = time.Now()
im.logInstanceReport()
}