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

     1  // Copyright 2014 Canonical Ltd.
     2  // Copyright 2014 Cloudbase Solutions SRL
     3  // Licensed under the AGPLv3, see LICENCE file for details.
     4  
     5  package worker
     6  
     7  import (
     8  	"github.com/juju/worker/v3"
     9  )
    10  
    11  func NewNoOpWorker() worker.Worker {
    12  	return NewSimpleWorker(doNothing)
    13  }
    14  
    15  func doNothing(stop <-chan struct{}) error {
    16  	select {
    17  	case <-stop:
    18  		return nil
    19  	}
    20  }