mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 04:12:26 -06:00
[chore]: Bump codeberg.org/gruf/go-runners from 1.4.0 to 1.5.1 (#1428)
Bumps codeberg.org/gruf/go-runners from 1.4.0 to 1.5.1. --- updated-dependencies: - dependency-name: codeberg.org/gruf/go-runners dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
1df25a3592
commit
0a9874329d
6 changed files with 45 additions and 40 deletions
22
vendor/codeberg.org/gruf/go-runners/pool.go
generated
vendored
22
vendor/codeberg.org/gruf/go-runners/pool.go
generated
vendored
|
@ -67,20 +67,14 @@ func (pool *WorkerPool) Start(workers int, queue int) bool {
|
|||
go func() {
|
||||
defer wait.Done()
|
||||
|
||||
// Run worker function.
|
||||
for !worker_run(ctx, fns) {
|
||||
// retry on panic
|
||||
// Run worker function (retry on panic)
|
||||
for !worker_run(CancelCtx(ctx), fns) {
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// Set GC finalizer to stop pool on dealloc.
|
||||
runtime.SetFinalizer(pool, func(pool *WorkerPool) {
|
||||
_ = pool.svc.Stop()
|
||||
})
|
||||
|
||||
// Wait on ctx
|
||||
<-ctx.Done()
|
||||
<-ctx
|
||||
|
||||
// Drain function queue.
|
||||
//
|
||||
|
@ -110,6 +104,16 @@ func (pool *WorkerPool) Stop() bool {
|
|||
return pool.svc.Stop()
|
||||
}
|
||||
|
||||
// Running returns if WorkerPool management loop is running (i.e. NOT stopped / stopping).
|
||||
func (pool *WorkerPool) Running() bool {
|
||||
return pool.svc.Running()
|
||||
}
|
||||
|
||||
// Done returns a channel that's closed when WorkerPool.Stop() is called. It is the same channel provided to the currently running worker functions.
|
||||
func (pool *WorkerPool) Done() <-chan struct{} {
|
||||
return pool.svc.Done()
|
||||
}
|
||||
|
||||
// Enqueue will add provided WorkerFunc to the queue to be performed when there is a free worker.
|
||||
// This will block until function is queued or pool is stopped. In all cases, the WorkerFunc will be
|
||||
// executed, with the state of the pool being indicated by <-ctx.Done() of the passed ctx.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue