Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/YSZhuoyang/go-dispatcher
/ functions
Functions
26 in github.com/YSZhuoyang/go-dispatcher
⨍
Functions
26
◇
Types & classes
10
↓ 11 callers
Function
NewDispatcher
NewDispatcher returns a new job dispatcher with a worker pool initialized with given number of workers.
dispatcher/dispatcher.go:80
↓ 7 callers
Method
Finalize
Finalize blocks until all jobs dispatched are finished and all workers are returned to worker pool. Note it must be called to terminate the dispatchin
dispatcher/dispatcher.go:22
↓ 4 callers
Method
DispatchWithDelay
DispatchWithDelay behaves similarly to Dispatch, except it is delayed for a given period of time (in nanoseconds) before the job is allocated to a wor
dispatcher/dispatcher.go:18
↓ 3 callers
Method
Dispatch
Dispatch gives a job to a worker at a time, and blocks until at least one worker becomes available. Each job dispatched is handled by a separate gorou
dispatcher/dispatcher.go:15
↓ 2 callers
Function
newError
(errMsg string)
dispatcher/error.go:11
↓ 1 callers
Method
Do
()
dispatcher/job.go:8
↓ 1 callers
Method
GetNumWorkersAvail
GetNumWorkersAvail returns the number of workers availalbe for tasks at the time it is called.
dispatcher/dispatcher.go:25
↓ 1 callers
Method
GetTotalNumWorkers
GetTotalNumWorkers returns total number of workers created by the dispatcher.
dispatcher/dispatcher.go:27
Method
Dispatch
(job Job)
dispatcher/dispatcher.go:37
Method
DispatchWithDelay
(job Job, delayPeriod time.Duration)
dispatcher/dispatcher.go:44
Method
Do
()
dispatcher/job.go:22
Method
Do
()
dispatcher/dispatcher_test.go:16
Method
Do
()
dispatcher/dispatcher_test.go:25
Method
Error
()
dispatcher/error.go:7
Method
Finalize
()
dispatcher/dispatcher.go:56
Method
GetNumWorkersAvail
()
dispatcher/dispatcher.go:70
Method
GetTotalNumWorkers
()
dispatcher/dispatcher.go:74
Function
TestDispatchingJobs
(T *testing.T)
dispatcher/dispatcher_test.go:121
Function
TestDispatchingJobsWithDelay
(T *testing.T)
dispatcher/dispatcher_test.go:141
Function
TestDispatchingJobsWithDelayError
(T *testing.T)
dispatcher/dispatcher_test.go:157
Function
TestDispatchingManyJobs
(T *testing.T)
dispatcher/dispatcher_test.go:171
Function
TestFinializingDelayedJobs
(T *testing.T)
dispatcher/dispatcher_test.go:90
Function
TestFinializingJobs
(T *testing.T)
dispatcher/dispatcher_test.go:75
Function
TestFinializingManyDelayedJobs
(T *testing.T)
dispatcher/dispatcher_test.go:105
Function
TestGoroutineLeaks
(T *testing.T)
dispatcher/dispatcher_test.go:33
Function
TestInitWorkerPool
(T *testing.T)
dispatcher/dispatcher_test.go:45