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 (*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.