REFACTOR
-
task.go: Refactored
taskHeapfrom a slice type to a struct, addedtasksandminCapfields to support dynamic minimum capacity. -
task.go: Updated
Len,Less,Swap,Push, andPopmethods oftaskHeapto fit the new struct structure. -
pending.go: Fixed
newPendinginitialization to calculate dynamic minimum capacity based onworkersandsize(max(16, min(size/8, size/workers))).
PERF
-
task.go: Optimized heap shrink logic, changed trigger condition from
capacity > taskHeapMinCap && length < capacity/4tocapacity > minCap*4 && length < capacity/taskHeapMinCapRatio. -
task.go: Improved shrink capacity calculation, using
max(capacity/4, minCap)to ensure it does not fall below the minimum capacity. -
pending.go: Optimized
promoteLockedaccess efficiency by retrieving thetasksfield first to avoid repeated access.
UPDATE
-
new.go: Fixed
newPendingcall, addedworkersparameter.
FIX
-
new.go: Added debug log for timeout trigger (
task.timeout_triggered), recording id, preset, and timeout information.
©️ 2025 邱敬幃 Pardn Chiu
Top comments (0)