tasks

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForceStop

func ForceStop(duration time.Duration, task goasync.Task) *forceStop

ForceStop Tasks are used to ensure a forceful termination even if subTasks don't properly stop executing

Args:

  • duration: time to wait for subtask to finish. If this time is reached an error is returned and subTask is ignored
  • task: task process that is wrapped to handle interruptions

func Interruptible

func Interruptible(signals []os.Signal, task goasync.Task) *interruptible

Interruptible Tasks are used to run any tasks that can be reloaded at runtime. When this task recieves an interrupt signal it will cancel the child Task process and call Cleanup. Then this will call Initialize and Execute again for the child Task.

Args:

  • signals: OS signals to capture and initiate the reload operation
  • task: task process that is wrapped to handle interruptions

func RepeatTimer

func RepeatTimer(repeatTime time.Duration, task goasync.Task) *repeatTimer

RepeatTimer Executeers are used to run periodic one off tasks on a timer. Args:

  • repeatTime: amount of time to wait between invoking the subTask
  • task: task process that is wrapped for the periodic timer

func Repeatable

func Repeatable(task goasync.Task) *repeatable

Repeatable Tasks are used to run any tasks that might fail with an error. This task will swallow ther `Run()` error for the passed in `task` argument and restart the process. Initialize and Cleanup errors are propigated as normal

func Running

func Running(started chan struct{}) *running

Running can be used to to if a TaskManager has started executing background threads. This is useful to know is a task manager received a HUP operation and all tasks were restared. passing in a new Running task will let us know when the task manager has started again

NOTE: that this subtask will exit so its intended to be used with a "Relaxed" task manager.

Args: * started - chan that will be closed when Execute(...) is called

Types

This section is empty.

Jump to

Keyboard shortcuts

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