# v1.1.0 Release Notes

## Features

### Custom Dependency Timeout
- Specify timeout via `Wait{ID: taskID, Delay: duration}`
- Default timeout is 1 minute when not configured

### Dependency Failure Handling Strategy
- Added `Stop` and `Skip` handling modes
  - `Stop`: Halt entire dependency chain on failure (default)
  - `Skip`: Skip failed dependency and continue executing current task
- Configure failure behavior via `Wait{ID: taskID, State: Skip}`

### Examples
```go
// Failure handling strategy
taskID, _ := scheduler.Add("@daily", func() error {
    return processData()
}, "Data processing", []Wait{
    {ID: taskA, State: Skip},  // Skip if taskA fails, continue execution
    {ID: taskB, State: Stop},  // Stop if taskB fails (default)
})

// Custom timeout + failure strategy combination
taskID, _ := scheduler.Add("@daily", func() error {
    return processData()
}, "Data processing", []Wait{
    {ID: taskA, Delay: 30 * time.Second, State: Skip},  // Wait 30s, skip on failure
    {ID: taskB, Delay: 10 * time.Second, State: Stop},  // Wait 10s, stop on failure
})

// Legacy version (deprecated in v2.*.*)
taskID, _ := scheduler.Add("@daily", func() error {
    return processData()
}, "Data processing", []int64{taskA, taskB})
```

## Refactor

### Compatibility Guarantee
- Legacy code runs without modification
- Maintains `[]int64` dependency support (deprecated in `v2.*.*`)
- `WaitState` zero value is `Stop`, ensuring default behavior unchanged

## Deprecation Notice

### Features Removed in `v2.*.*`
- `[]int64` format: Migrate to `[]Wait` format for full feature support
  ```go
  // Old format
  []int64{taskA, taskB}
  
  // New format
  []Wait{{ID: taskA}, {ID: taskB}}
  ```

***

## 新增

### 自定義依賴超時時間
- 透過 `Wait{ID: taskID, Delay: duration}` 指定超時時間
- 未設定時預設超時為 1 分鐘

### 依賴失敗處理策略
- 新增 `Stop` 和 `Skip` 兩種處理方式
  - `Stop`: 依賴失敗時停止整個依賴鏈（預設）
  - `Skip`: 依賴失敗時跳過失敗的依賴，繼續執行當前任務
- 透過 `Wait{ID: taskID, State: Skip}` 設定失敗行為

### 範例
```go
// 失敗處理策略
taskID, _ := scheduler.Add("@daily", func() error {
    return processData()
}, "Data processing", []Wait{
    {ID: taskA, State: Skip},  // taskA 失敗時跳過，繼續執行
    {ID: taskB, State: Stop},  // taskB 失敗時停止（預設）
})

// 自定義超時 + 失敗策略組合
taskID, _ := scheduler.Add("@daily", func() error {
    return processData()
}, "Data processing", []Wait{
    {ID: taskA, Delay: 30 * time.Second, State: Skip},  // 等待 30 秒，失敗時跳過
    {ID: taskB, Delay: 10 * time.Second, State: Stop},  // 等待 10 秒，失敗時停止
})

// 舊版本（將在 v2.*.* 廢棄）
taskID, _ := scheduler.Add("@daily", func() error {
    return processData()
}, "Data processing", []int64{taskA, taskB})
```

## 重構

### 相容性保證
- 舊版本代碼無需修改即可正常運行
- 保留 `[]int64` 依賴支援（將在 `v2.*.*` 廢棄）
- `WaitState` 零值為 `Stop`，確保預設行為不變

## 棄用預告

### 將在 `v2.*.*` 移除的功能
- `[]int64` 格式：建議遷移至 `[]Wait` 格式以獲得完整功能支援
  ```go
  // 舊格式
  []int64{taskA, taskB}
  
  // 新格式
  []Wait{{ID: taskA}, {ID: taskB}}
  ```