Skip to content

v1.1.3

Latest

Choose a tag to compare

@pardnchiu pardnchiu released this 01 Jan 13:31
· 6 commits to master since this release

REFACTOR

  • Replace Queue.closed bool + sync.RWMutex with atomic.Uint32 state
  • Use CAS in Start() to ensure transition from stateCreated to stateRunning only
  • Use CAS loop in Shutdown() for idempotent closure (allow multiple calls)

UPDATE

  • Change Start() return type to error for state check error reporting
  • Change Config.Timeout type from int64 to time.Duration
  • Change default Timeout from 30 to 30 * time.Second

FIX

  • Fix Enqueue() error message formatting, use %w to wrap underlying error
  • Fix Shutdown() to call cancel() after completion for context cleanup

REFACTOR

  • 將 Queue.closed bool + sync.RWMutex 替換為 atomic.Uint32 state
  • 在 Start() 中使用 CAS 確保只能從 stateCreated 轉換到 stateRunning
  • 在 Shutdown() 中使用 CAS loop 確保冪等性關閉(允許多次調用)

UPDATE

  • 修改 Start() 返回型別為 error,支援狀態檢查錯誤回報
  • Config.Timeout 型別從 int64 改為 time.Duration
  • 預設 Timeout 值從 30 改為 30 * time.Second

FIX

  • 修正 Enqueue() 錯誤訊息格式化,使用 %w 包裹底層錯誤
  • 修正 Shutdown() 在完成後呼叫 cancel() 清理 context