github.com/prebid/prebid-server/v2@v2.18.0/util/task/func_runner.go (about)

     1  package task
     2  
     3  import "time"
     4  
     5  type funcRunner struct {
     6  	run func() error
     7  }
     8  
     9  func (r funcRunner) Run() error {
    10  	return r.run()
    11  }
    12  
    13  func NewTickerTaskFromFunc(interval time.Duration, runner func() error) *TickerTask {
    14  	return NewTickerTask(interval, funcRunner{run: runner})
    15  }