workers

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	Platform   platforms.Platform
	Owner      string
	Repository string
	Config     *config.RepoConfig
}

Job define information about the job to process

func NewJob

func NewJob(platform platforms.Platform, owner, repository string) (job *Job, err error)

NewJob return a Job to be processed by a worker

func (*Job) Process

func (j *Job) Process() (err error)

Process job by getting all the draft/unpublished releases, for each release check that all the required status succeeded then publish the release

type Worker

type Worker struct {
	ID     int
	Job    chan *Job
	Queue  chan chan *Job
	Cancel chan struct{}
}

Worker process jobs from a queue

func NewWorker

func NewWorker(id int, queue chan chan *Job, cancel chan struct{}) *Worker

NewWorker return a worker which process jobs from a queue

func (*Worker) Start

func (w *Worker) Start()

Start worker and process job from the queue when they arrive

type WorkerPool

type WorkerPool struct {

	// Job queue
	JobQueue chan *Job

	// WorkerQueue is the job queue of a worker
	WorkerQueue chan chan *Job

	// Workers
	Workers []*Worker
}

WorkerPool dispatch jobs to a pool of workers

func NewWorkerPool

func NewWorkerPool(workerCount int, cancel chan struct{}) *WorkerPool

NewWorkerPool return a WorkerPool to process jobs

func (*WorkerPool) Start

func (wp *WorkerPool) Start()

Start worker pool and dispatch job from JobQueue to the worker queue

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL