cmd/stepd: Be able to trim multiple things
This commit is contained in:
parent
df7c49247b
commit
60c52ee4ce
@ -225,7 +225,9 @@ func main () {
|
|||||||
|
|
||||||
// set up the trimming routine
|
// set up the trimming routine
|
||||||
trimmer := trimmerRoutine {
|
trimmer := trimmerRoutine {
|
||||||
Trimmer: &handler,
|
Trimmers: []step.Trimmer {
|
||||||
|
&handler,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up the routine manager
|
// set up the routine manager
|
||||||
@ -266,7 +268,7 @@ func (this *httpServerRoutine) Run (ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type trimmerRoutine struct {
|
type trimmerRoutine struct {
|
||||||
Trimmer step.Trimmer
|
Trimmers []step.Trimmer
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *trimmerRoutine) Run (ctx context.Context) error {
|
func (this *trimmerRoutine) Run (ctx context.Context) error {
|
||||||
@ -275,7 +277,9 @@ func (this *trimmerRoutine) Run (ctx context.Context) error {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <- ticker.C:
|
case <- ticker.C:
|
||||||
this.Trimmer.Trim()
|
for _, trimmer := range this.Trimmers {
|
||||||
|
trimmer.Trim()
|
||||||
|
}
|
||||||
case <- ctx.Done():
|
case <- ctx.Done():
|
||||||
return ctx.Err()
|
return ctx.Err()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user