workerpoolservice

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: AGPL-3.0, AGPL-3.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	TotalTimeout    time.Duration `yaml:"total_timeout" json:"total_timeout"`       // максимальное время обработки
	ShutdownTimeout time.Duration `yaml:"shutdown_timeout" json:"shutdown_timeout"` // максимальное время жестокой остановки worker
	WPCfg           _wp.Config    `yaml:"worker_pool" json:"worker_pool"`           // конфигурационные параметры
}

Config конфигурационные настройки

type Service

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

Service represent WorkerPool service

func New

func New(parentCtx context.Context, name string, errCh chan<- error, cfg *Config) (*Service, error)

New - create WorkerPool service

func (*Service) AddTask

func (s *Service) AddTask(task *_wp.Task) error

AddTask добавляет таски в pool - если очередь переполнена, то ожидание

func (*Service) GetWPConfig

func (s *Service) GetWPConfig() *_wp.Config

GetWPConfig конфигурация workerpool

func (*Service) Run

func (s *Service) Run() (err error)

Run - wait for error or exit

func (*Service) RunTasksGroupCh

func (s *Service) RunTasksGroupCh(externalId uint64, tasks []*_wp.Task, taskGroupName string) (err error)

RunTasksGroupCh - запустить группу задач в отдельной chanel с возможностью остановки

func (*Service) RunTasksGroupWG

func (s *Service) RunTasksGroupWG(externalId uint64, tasks []*_wp.Task, taskGroupName string) (err error)

RunTasksGroupWG - запустить группу задач в отдельной WG

func (*Service) Shutdown

func (s *Service) Shutdown(hardShutdown bool, shutdownTimeout time.Duration) (err error)

Shutdown shutting down service

Jump to

Keyboard shortcuts

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