Commit c9decd6
committed
feat: add configurable timeout to stop() method
Enhance stop() method to wait for in-flight jobs to complete before
returning, with configurable timeout option.
Changes:
- Add optional timeout parameter (default: 30 seconds)
- Wait for all concurrent jobs to finish gracefully
- Log timeout events and remaining job count
- Provide predictable stop behavior for production use
Usage:
- await queue.stop() // 30s default timeout
- await queue.stop({ timeout: 5000 }) // custom timeout
This enables reliable graceful shutdown and prevents orphaned work
during application restarts or shutdowns.1 parent 9dff497 commit c9decd6
1 file changed
+23
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
154 | 157 | | |
155 | | - | |
| 158 | + | |
156 | 159 | | |
| 160 | + | |
157 | 161 | | |
158 | 162 | | |
159 | | - | |
| 163 | + | |
| 164 | + | |
160 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
161 | 182 | | |
162 | 183 | | |
163 | 184 | | |
| |||
0 commit comments