taskreaper

package
v1.12.1-0...-676f45f Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskReaper

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

A TaskReaper deletes old tasks when more than TaskHistoryRetentionLimit tasks exist for the same service/instance or service/nodeid combination.

func New

func New(store *store.MemoryStore) *TaskReaper

New creates a new TaskReaper.

func (*TaskReaper) Run

func (tr *TaskReaper) Run(ctx context.Context)

Run is the TaskReaper's watch loop which collects candidates for cleanup. Task history is mainly used in task restarts but is also available for administrative purposes. Note that the task history is stored per-slot-per-service for replicated services and per-node-per-service for global services. History does not apply to serviceless tasks since they are not attached to a service. In addition, the TaskReaper watch loop is also responsible for cleaning up tasks associated with slots that were removed as part of service scale down or service removal.

func (*TaskReaper) Stop

func (tr *TaskReaper) Stop()

Stop stops the TaskReaper and waits for the main loop to exit. Stop can be called in two cases. One when the manager is shutting down, and the other when the manager (the leader) is becoming a follower. Since these two instances could race with each other, we use closeOnce here to ensure that TaskReaper.Stop() is called only once to avoid a panic.

Jump to

Keyboard shortcuts

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