v1.1.3

Anti-Starvation Promotion

Last updated

This page explains how go-queue lifts long-waiting Low and Normal tasks so a steady stream of urgent work cannot starve them.

Promotion Rules

Each time a worker calls Pop, promoteLocked scans the whole heap and lifts long-waiting tasks one level (core/pending.go:111).

From To Wait Threshold
PriorityLow PriorityNormal clamp(Config.Timeout, 30s, 120s)
PriorityNormal PriorityHigh clamp(Config.Timeout × 2, 30s, 120s)

With the default Config.Timeout = 30s, a Low task becomes Normal after 30s, and a Normal task becomes High after 60s.

Boundaries

中文