Commit c260ad0
authored
Conductor (#73)
Implement Conductor client.
# Design
A conductor object is attached to a `DBOSContext`. Its lifecycle
management is done like other resources, inside `DBOSContext` `Launch`
and `Shutdown` methods.
The conductor operates through two goroutines a "main" goroutine
handling conductor messages, and a "ping" goroutine to keep the
connection alive.
# Main goroutine
- Handles connecting to conductor
- Handles responding to conductor message
- Will stop only if its context is cancelled (root DBOSContext)
The main goroutine is entirely responsible for managing the connection:
whenever it detects it should connect to the server, it'll start a ping
goroutine. Whenever it gets an error (e.g., reading on the websocket or
sending a message), it will set the connection for closing.
# Ping goroutine
- Periodically sends keepalive pings to the server
- Handles pong answers
The ping goutine will exit and signal the connection should be close if:
- Its context is cancelled or
- It gets an error trying to send the ping
# Others
- There cannot be concurrent writers on the websocket, so all write
operations are protected by a mutex
- Shutdown logic: we cancel the ping goroutine, close the connection and
wait for both goroutine to terminate.
- Add a missing executors ID filter on `ListWorkflows`1 parent 60907cf commit c260ad0
File tree
14 files changed
+2192
-61
lines changed- dbos
14 files changed
+2192
-61
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | 37 | | |
41 | 38 | | |
42 | 39 | | |
| |||
0 commit comments