You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-1Lines changed: 42 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,7 +143,48 @@ The `Stop` method gracefully shuts down the Queuer instance, releasing resources
143
143
func (q *Queuer) Stop() error
144
144
```
145
145
146
-
The `Stop` method cancels all jobs, closes db listeners and returns an error if any step of the stopping process encounters an issue
146
+
The `Stop` method cancels all jobs, closes db listeners and returns an error if any step of the stopping process encounters an issue. **Note:** This method can only be used to stop the current worker instance that the code is running in. To stop other workers, use `StopWorker` or `StopWorkerGracefully`.
147
+
148
+
---
149
+
150
+
## StopWorker
151
+
152
+
The `StopWorker` method immediately stops a worker by setting its status to `STOPPED`. This will cancel all running jobs on that worker.
- `workerRID`: The `uuid.UUID` identifying the worker to stop.
159
+
160
+
When a worker is stopped:
161
+
- The worker status is immediately set to `STOPPED` in the database
162
+
- The heartbeat ticker detects the `STOPPED` status and calls `Stop()` on that worker
163
+
- All running jobs on that worker are cancelled immediately
164
+
- The worker will no longer accept new jobs
165
+
166
+
This method is useful for immediately shutting down a worker, for example in emergency situations or when you need to take a worker offline quickly.
167
+
168
+
---
169
+
170
+
## StopWorkerGracefully
171
+
172
+
The `StopWorkerGracefully` method gracefully stops a worker by setting its status to `STOPPING`. This allows currently running jobs to complete before the worker shuts down.
0 commit comments