Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(async): change the channel type on pool.Start (#54) #55

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions async/worker-pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ func (p *WorkerPool[I, O]) composeID() WorkerID {

func (p *WorkerPool[I, O]) Start(
ctx context.Context,
outputsChOut OutputStreamW[O],
outputsChOut OutputStream[O],
) {
p.run(ctx, p.private.workersJobsCh, outputsChOut)
}

func (p *WorkerPool[I, O]) run(
ctx context.Context,
forwardChOut JobStreamW[I],
outputsChOut OutputStreamW[O],
outputsChOut OutputStream[O],
) {
defer func() {
if outputsChOut != nil {
Expand Down Expand Up @@ -171,7 +171,7 @@ func (p *WorkerPool[I, O]) run(
func (p *WorkerPool[I, O]) spawn(
ctx context.Context,
jobsChIn JobStreamR[I],
outputsChOut OutputStreamW[O],
outputsChOut OutputStream[O],
finishedChOut FinishedStreamW,
) {
cancelCh := make(CancelStream, 1)
Expand Down
2 changes: 1 addition & 1 deletion async/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type worker[I any, O any] struct {
id WorkerID
exec ExecutiveFunc[I, O]
jobsChIn JobStreamR[I]
outputsChOut OutputStreamW[O]
outputsChOut OutputStream[O]
finishedChOut FinishedStreamW

// this might be better replaced with a broadcast mechanism such as sync.Cond
Expand Down