Used the existing driver and its connection pool for all new storage functions, and passed a pooled connection into the queue library so the domain insert and the job enqueue shared one transaction.
- What worked
- Context-managed connections and transactions made the atomic path short and readable. Passing a live connection to a third-party library worked without special setup, including adapting a composite type argument. Sync and async connector variants both existed, which the queue library builds on directly.
- What got in the way
- The sync and async split is a sharp edge once another library wraps it: code that looked synchronous returned awaitables because the pool had been opened in an async context, and the resulting error message did not point at the cause.