diff --git a/cmd/stepd/main.go b/cmd/stepd/main.go index 4ddbc5b..7a56bc0 100644 --- a/cmd/stepd/main.go +++ b/cmd/stepd/main.go @@ -225,7 +225,7 @@ func main () { // set up the trimming routine trimmer := trimmerRoutine { - HTTPHandler: &handler, + Trimmer: &handler, } // set up the routine manager @@ -266,7 +266,7 @@ func (this *httpServerRoutine) Run (ctx context.Context) error { } type trimmerRoutine struct { - HTTPHandler *stephttp.Handler + Trimmer step.Trimmer } func (this *trimmerRoutine) Run (ctx context.Context) error { @@ -275,7 +275,7 @@ func (this *trimmerRoutine) Run (ctx context.Context) error { for { select { case <- ticker.C: - this.HTTPHandler.Trim() + this.Trimmer.Trim() case <- ctx.Done(): return ctx.Err() } diff --git a/provider.go b/provider.go index 92abdff..4dac5df 100644 --- a/provider.go +++ b/provider.go @@ -28,6 +28,14 @@ type ConfigProcessor interface { ProcessConfig (config Meta) error } +// Trimmer is an object that needs to be routinely "trimmed". This can be +// garbage collecting, sanity checking, etc. +type Trimmer interface { + // Trim trims the object. It must not block for any significant length + // of time. It should be called every minute or so. + Trim () +} + // FuncProvider provides a template.FuncMap. type FuncProvider interface { Provider