taskqueue

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 1 Imported by: 30

Documentation

Overview

Package taskqueue implements a callback queuer to be used with the event loop in k6

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Task

type Task func() error

Task is just a representation of a task that will be added to the event loop

type TaskQueue

type TaskQueue struct {
	// contains filtered or unexported fields
}

TaskQueue makes it easy to queue multiple callback to the k6 event loop. This in particular works around the problem that in order to queue a callback you need to be on the event loop But if you already use the callback you need to wait for the queued callback to be executed to "reset" the callback while it's executing on the event loop

func New

func New(registerCallback func() func(func() error)) *TaskQueue

New returns a new CallbackQueuer that will use the provide registrerCallback function

func (*TaskQueue) Close

func (tq *TaskQueue) Close()

Close will stop the queue letting the event loop finish, and is required to be called for that reason

func (*TaskQueue) Queue

func (tq *TaskQueue) Queue(t Task)

Queue the provided function for execution. If used after Close is called it will not actually execute anything or return an error

Jump to

Keyboard shortcuts

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