dissolve

package
v0.33.4 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dissolver

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

Dissolver allows to put function to in-memory queue and process it with workers until success. The order of execution is not maintained. Jobs will be lost after closing. Jobs not saved to persistent store so do not survive process restart. Centrifuge uses this for asynchronously unsubscribing node from channels in broker. As soon as process restarts all connections to broker get closed automatically so it's ok to lose jobs inside Dissolver queue.

func New

func New(numWorkers int) *Dissolver

New creates new Dissolver.

func (*Dissolver) Close

func (d *Dissolver) Close() error

Close stops processing Jobs, no more Jobs can be submitted after closing.

func (*Dissolver) Run

func (d *Dissolver) Run() error

Run launches workers to process Jobs from queue concurrently.

func (*Dissolver) Submit

func (d *Dissolver) Submit(job Job) error

Submit Job to be reliably processed.

type Job

type Job func() error

Job to do.

Jump to

Keyboard shortcuts

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