parallel

package
v0.0.0-...-7c5bcf4 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package parallel provides a parallel scheduler that will run work on a fixed number of workers. Events for the same repository will be processed sequentially, but events for different repositories can be processed concurrently.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

Scheduler is a parallel scheduler that will run work on a fixed number of workers

func NewScheduler

func NewScheduler(numWorkers int, ident string, logger *slog.Logger, handleEvent func(context.Context, *models.Event) error) *Scheduler

NewScheduler creates a new parallel scheduler with the given number of workers

func (*Scheduler) AddWork

func (p *Scheduler) AddWork(ctx context.Context, repo string, val *models.Event) error

AddWork adds work to the scheduler

func (*Scheduler) Shutdown

func (p *Scheduler) Shutdown()

Shutdown shuts down the scheduler, waiting for all workers to finish their current work The existing work queue will be processed, but no new work will be accepted

Jump to

Keyboard shortcuts

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