Skip to main content

Results

Task execution results and errors are returned through dedicated channels.

🛠 Accessing Channels​

  • Use GetResults() to access the results channel.
  • Use GetErrors() to access the errors channel.

Both channels are buffered and should be closed manually after processing to avoid memory leaks or deadlocks.

📚 See Tasks for how tasks are dispatched and executed.

🚀 Example​

select {
case result := <-w.GetResults():
fmt.Println(result)

case err := <-w.GetErrors():
log.Fatalf("error executing task: %v", err)
}

close(w.GetResults())
close(w.GetErrors())

📋 Channel Types​

  • Results channel: chan R, where R is the result type specified during controller creation (workers.New()).
  • Errors channel: chan error.