Create Trimmer interface
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user