simplebroker-pg 2.2.0__tar.gz → 2.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,10 @@ __pycache__/
9
9
  .Python
10
10
  .code
11
11
  .codex
12
+ .claude
13
+ .agents
14
+ .claude/
15
+ .agents/
12
16
  docs/
13
17
  build/
14
18
  develop-eggs/
@@ -46,6 +50,7 @@ env/
46
50
  coverage.xml
47
51
  .pytest_cache/
48
52
  htmlcov/
53
+ .hypothesis/
49
54
  .tox/
50
55
  .nox/
51
56
  .mypy_cache/
@@ -73,13 +78,6 @@ Thumbs.db
73
78
  *.log
74
79
 
75
80
  # Multi-agent
76
- .claude/*
77
- !.claude/
78
- !.claude/skills/
79
- !.claude/skills/**
80
- !.agents/
81
- !.agents/skills/
82
- !.agents/skills/**
83
81
  .mcp.json
84
82
  agent_history/
85
83
  .broker.db
@@ -90,3 +88,6 @@ weft/
90
88
  .codex*
91
89
  .code*
92
90
  .coder*
91
+
92
+ # Codex CLI session metadata
93
+ .context/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simplebroker-pg
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: Postgres backend plugin for SimpleBroker
5
5
  Author-email: Van Lindberg <van.lindberg@gmail.com>
6
6
  License: MIT
@@ -8,7 +8,7 @@ License-File: LICENSE
8
8
  Requires-Python: >=3.11
9
9
  Requires-Dist: psycopg-pool>=3.1
10
10
  Requires-Dist: psycopg[binary]>=3
11
- Requires-Dist: simplebroker>=4.3.0
11
+ Requires-Dist: simplebroker>=4.8.0
12
12
  Provides-Extra: dev
13
13
  Requires-Dist: pytest-timeout>=2.4.0; extra == 'dev'
14
14
  Requires-Dist: pytest>=7.0; extra == 'dev'
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "simplebroker-pg"
7
- version = "2.2.0"
7
+ version = "2.3.0"
8
8
  description = "Postgres backend plugin for SimpleBroker"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -14,7 +14,7 @@ authors = [
14
14
  {name = "Van Lindberg", email = "van.lindberg@gmail.com"},
15
15
  ]
16
16
  dependencies = [
17
- "simplebroker>=4.3.0",
17
+ "simplebroker>=4.8.0",
18
18
  "psycopg[binary]>=3",
19
19
  "psycopg-pool>=3.1",
20
20
  ]
@@ -22,6 +22,14 @@ SELECT EXISTS(
22
22
  )
23
23
  """
24
24
 
25
+ GET_LATEST_PENDING_TIMESTAMP = """
26
+ SELECT ts
27
+ FROM messages
28
+ WHERE queue = ? AND claimed = FALSE
29
+ ORDER BY ts DESC
30
+ LIMIT 1
31
+ """
32
+
25
33
  CHECK_QUEUE_EXISTS = """
26
34
  SELECT EXISTS(
27
35
  SELECT 1
@@ -197,6 +197,24 @@ def meta_table_exists(runner: SQLRunner) -> bool:
197
197
  return bool(rows and rows[0][0])
198
198
 
199
199
 
200
+ def queue_ts_order_unclaimed_index_exists(runner: SQLRunner) -> bool:
201
+ """Return whether the pending queue/timestamp index exists."""
202
+ rows = list(
203
+ runner.run(
204
+ """
205
+ SELECT EXISTS(
206
+ SELECT 1
207
+ FROM pg_indexes
208
+ WHERE schemaname = current_schema()
209
+ AND indexname = 'idx_messages_queue_ts_order_unclaimed'
210
+ )
211
+ """,
212
+ fetch=True,
213
+ )
214
+ )
215
+ return bool(rows and rows[0][0])
216
+
217
+
200
218
  def migrate_schema(
201
219
  runner: SQLRunner,
202
220
  *,
@@ -205,6 +223,15 @@ def migrate_schema(
205
223
  ) -> None:
206
224
  """Apply any missing Postgres schema migrations in order."""
207
225
  if current_version >= POSTGRES_SCHEMA_VERSION:
226
+ if queue_ts_order_unclaimed_index_exists(runner):
227
+ return
228
+ runner.begin_immediate()
229
+ try:
230
+ runner.run(CREATE_QUEUE_TS_ORDER_UNCLAIMED_INDEX)
231
+ runner.commit()
232
+ except Exception:
233
+ runner.rollback()
234
+ raise
208
235
  return
209
236
 
210
237
  runner.begin_immediate()
File without changes