Skip to content

TaskManager: queue で待機中のタスクの優先度を時間経過で自動昇格 (aging) させたい #1311

@isamu

Description

@isamu

Background

#1304 で導入予定の concurrency per label + HoL (head-of-line) skip 方式では、特定 label が混んでいるとその label のタスクがキューに残り続ける可能性があります。

優先度ベースのスケジューリング(priority フィールド)と組み合わせると、低 priority のタスクは「label が空いた時に既に高 priority タスクが先回りで入ってくる」状況で永続的に動かない(スターベーション)リスクがあります。

Proposal

各タスクが queue に入ってからの経過時間に応じて effective priority を自動で底上げする「エイジング」を TaskManager に追加する。

// TaskManager 内で擬似的に
effectivePriority(task) = task.node.priority + Math.floor(waitedMs / agingIntervalMs)
  • agingIntervalMs は engine の option(例: 10000ms = 10秒待つごとに +1)
  • デフォルト無効(後方互換)

Why

  • HoL skip で発生し得るスターベーションの保険
  • 「いつかは絶対に動く」を保証することで、ユーザは priority を安心して使える

Scope

  • TaskManager.addTaskenqueuedAt を記録
  • dequeueTaskIfPossible 内で実効 priority を計算してキューを再評価
  • グラフ option aging?: { intervalMs: number } を追加
  • ユニットテスト追加

Out of scope

  • 動的優先度の他用途(例: 依存先の数による優先度変動)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions