This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package alertcontrol
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ExpiryJob struct {
|
||||
Store Store
|
||||
Now func() time.Time
|
||||
}
|
||||
|
||||
func (job ExpiryJob) Run(ctx context.Context) (ExpiryResult, error) {
|
||||
if job.Now == nil {
|
||||
job.Now = time.Now
|
||||
}
|
||||
return job.Store.Expire(ctx, job.Now().UTC())
|
||||
}
|
||||
Reference in New Issue
Block a user