Repository navigation
Conversation
Coverage Report for CI Build 37736583607Coverage decreased (-0.8%) to 90.132%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Jobs live in Postgres. Engine.join_transaction inserts them on the caller's open transaction, so application rows and job rows commit or roll back together. PostgresBroker runs queues, future jobs, periodic tasks, concurrency limits, namespaces, broker keepalive, and recovery after a broker dies. A joined connection must be the same cluster, database, and Spinach tables as the broker. Startup checks schema version 1, column shape, the position and idempotency defaults, and sslmode=verify-full. Co-authored-by: Julian Edwards <bigjools@gmail.com>
cursor
Bot
force-pushed
the
cursor/postgres-broker-plan-e7fb
branch
from
October 8, 2026 06:15
84d44df to
4c2c889
Compare
Owner
Author
|
See NicolasLM#51 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
PostgresBroker. Jobs live in Postgres. Application code can insert a job in its own transaction, so the job and the local rows commit together or roll back together.pip install spinach[postgres]installs psycopg 3. The DSN comes from the application.Engine.join_transactionschedules on the caller's open transaction when the broker setssupports_join_transaction.PostgresBrokerinserts the job rows on that connection and does not commit it. Workers see the job when the caller commits. Rollback removes both.RuntimeError. A task parameter namedconnectionis still passed to the task.require_ssldefaults to True. The session must use TLS withsslmode=verify-full.sslmode=requireis rejected because the server certificate is not verified. Production DSNs use SCRAM-SHA-256 andsslrootcert. Check the server certificate withopenssl x509 -text -nooutbefore trusting it. Tests passrequire_ssl=Falsebecause the test server uses trust authentication.join_transactioncomparespg_control_system().system_identifier,current_database(), and the OIDs ofspinach_queue_jobandspinach_future_job. The same cluster, database, and tables match whatever host string or socket was used. Asearch_paththat finds a different copy is rejected.INSERTon the queue and future tables andUSAGEon the position sequence can schedule. A failure requeue still clears that job's running row and frees its concurrency slot.to_regclassand checks column types, nullability, primary keys, thepositionsequence default, the idempotencynow()default, andspinach_schemaversion 1. A stub earlier onsearch_pathis rejected. A discarded job from a dead broker releases its concurrency slot. An empty task list clears concurrency rows.doc/user/postgres.rstexplains how to use, deploy, and control the broker.doc/hacking/postgres-broker.rstdescribes the implementation.Test plan
pytest— 160 passed, including an insert-only role, a hiddensearch_path, missing column defaults, and a failure requeue clearing the running row.tests/functional/test_concurrency.py— two workers andmax_concurrency=1on memory, Redis, and Postgres.pycodestyle --ignore=E252,W503,W504 spinach tests