Skip to content

Commit c260ad0

Browse files
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

14 files changed

+2192
-61
lines changed

dbos/admin_server_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ func TestAdminServer(t *testing.T) {
3434
}
3535
}()
3636

37-
// Give time for any startup processes
38-
time.Sleep(100 * time.Millisecond)
39-
4037
// Verify admin server is not running
4138
client := &http.Client{Timeout: 1 * time.Second}
4239
_, err = client.Get(fmt.Sprintf("http://localhost:3001/%s", strings.TrimPrefix(_HEALTHCHECK_PATTERN, "GET /")))

0 commit comments

Comments
 (0)