Create Trimmer interface

This commit is contained in:
2024-12-12 18:10:20 -05:00
parent 424eebde84
commit df7c49247b
2 changed files with 11 additions and 3 deletions

View File

@@ -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()
}