Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TaskStore ¶
type TaskStore interface {
FindOne(ctx context.Context, id int64) (*task.Task, error)
Update(ctx context.Context, data *task.Task) error
}
TaskStore is the minimal task repository interface needed by the batch-email worker.
type WorkerManager ¶
type WorkerManager struct {
// contains filtered or unexported fields
}
WorkerManager owns asynchronous batch-email workers. It is an application worker, so it belongs in internal rather than the reusable email package.
var (
Manager *WorkerManager
)
func NewWorkerManager ¶
func NewWorkerManager(tasks TaskStore, sender emailpkg.Sender) *WorkerManager
func (*WorkerManager) AddWorker ¶
func (m *WorkerManager) AddWorker(id int64)
AddWorker starts a worker only when one is not already processing the task.
func (*WorkerManager) GetWorker ¶
func (m *WorkerManager) GetWorker(id int64) *Worker
GetWorker returns the worker currently assigned to id.
func (*WorkerManager) RemoveWorker ¶
func (m *WorkerManager) RemoveWorker(id int64)
RemoveWorker cancels and removes the worker assigned to id.
Click to show internal directories.
Click to hide internal directories.