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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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