github.com/juju/juju@v0.0.0-20240327075706-a90865de2538/worker/runner.go (about)

     1  // Copyright 2012, 2013 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package worker
     5  
     6  import (
     7  	"time"
     8  
     9  	"github.com/juju/worker/v3"
    10  )
    11  
    12  // RestartDelay holds the length of time that a worker
    13  // will wait between exiting and restarting.
    14  const RestartDelay = 3 * time.Second
    15  
    16  // Runner is implemented by instances capable of starting and stopping workers.
    17  type Runner interface {
    18  	worker.Worker
    19  	StartWorker(id string, startFunc func() (worker.Worker, error)) error
    20  	StopWorker(id string) error
    21  }