svc-infra 0.1.626__py3-none-any.whl → 0.1.627__py3-none-any.whl

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.

Potentially problematic release.


This version of svc-infra might be problematic. Click here for more details.

svc_infra/jobs/queue.py CHANGED
@@ -69,5 +69,13 @@ class InMemoryJobQueue:
69
69
  job.last_error = error
70
70
  # Exponential backoff: base * attempts
71
71
  delay = job.backoff_seconds * max(1, job.attempts)
72
- job.available_at = now + timedelta(seconds=delay)
72
+ if delay > 0:
73
+ # Add a tiny fudge so an immediate subsequent poll in ultra-fast
74
+ # environments (like our acceptance API) doesn't re-reserve the job.
75
+ # This keeps tests deterministic without impacting semantics.
76
+ job.available_at = now + timedelta(seconds=delay, milliseconds=250)
77
+ else:
78
+ # When backoff is explicitly zero (e.g., unit tests forcing
79
+ # immediate retry), make the job available right away.
80
+ job.available_at = now
73
81
  return
@@ -3,7 +3,6 @@ from __future__ import annotations
3
3
  from dataclasses import dataclass, field
4
4
  from datetime import datetime, timezone
5
5
  from typing import Dict, List
6
-
7
6
  from uuid import uuid4
8
7
 
9
8
  from svc_infra.db.outbox import OutboxStore
@@ -22,7 +21,16 @@ class InMemoryWebhookSubscriptions:
22
21
  self._subs: Dict[str, List[WebhookSubscription]] = {}
23
22
 
24
23
  def add(self, topic: str, url: str, secret: str) -> None:
25
- self._subs.setdefault(topic, []).append(WebhookSubscription(topic, url, secret))
24
+ # Upsert semantics per (topic, url): if a subscription already exists
25
+ # for this topic and URL, rotate its secret instead of adding a new row.
26
+ # This mirrors typical real-world secret rotation flows where the
27
+ # endpoint remains the same but the signing secret changes.
28
+ lst = self._subs.setdefault(topic, [])
29
+ for sub in lst:
30
+ if sub.url == url:
31
+ sub.secret = secret
32
+ return
33
+ lst.append(WebhookSubscription(topic, url, secret))
26
34
 
27
35
  def get_for_topic(self, topic: str) -> List[WebhookSubscription]:
28
36
  return list(self._subs.get(topic, []))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: svc-infra
3
- Version: 0.1.626
3
+ Version: 0.1.627
4
4
  Summary: Infrastructure for building and deploying prod-ready services
5
5
  License: MIT
6
6
  Keywords: fastapi,sqlalchemy,alembic,auth,infra,async,pydantic
@@ -252,7 +252,7 @@ svc_infra/jobs/builtins/outbox_processor.py,sha256=VZoehNyjdaV_MmV74WMcbZR6z9E3V
252
252
  svc_infra/jobs/builtins/webhook_delivery.py,sha256=z_cl6YKwnduGjGaB8ZoUpKhFcEAhUZqqBma8v2FO1so,2982
253
253
  svc_infra/jobs/easy.py,sha256=eix-OxWeE3vdkY3GGNoYM0GAyOxc928SpiSzMkr9k0A,977
254
254
  svc_infra/jobs/loader.py,sha256=LFO6gOacj6rT698vkDg0YfcHDRTue4zus3Nl9QrS5R0,1164
255
- svc_infra/jobs/queue.py,sha256=PS5f4CJm5_K7icojTxZOwC6uKw3O2M-jE111u85ySbA,2288
255
+ svc_infra/jobs/queue.py,sha256=KNpYU_za8B7mmmWY6eWDohSRYy7VIKHyWAGD1qkXUOw,2816
256
256
  svc_infra/jobs/redis_queue.py,sha256=wgmWKslF1dkYscJe49UgUX7gwEuGyOUWEb0-pn82I3g,7543
257
257
  svc_infra/jobs/scheduler.py,sha256=dTUEEyEuTVHNmJT8wPdMu4YjnTN7R_YW67gtCKpqC7M,1180
258
258
  svc_infra/jobs/worker.py,sha256=T2A575_mnieJHPOYU_FseubLA_HQf9pB4CkRgzRJBHU,694
@@ -323,9 +323,9 @@ svc_infra/webhooks/__init__.py,sha256=fvPhbFoS6whoT67DWp43pL3m1o-et104vwqxunCUAP
323
323
  svc_infra/webhooks/add.py,sha256=u9Spfwg0ztQmXg7uXP1sZ9-_qwnagnW4UnV9HvQtPwc,12191
324
324
  svc_infra/webhooks/fastapi.py,sha256=BCNvGNxukf6dC2a4i-6en-PrjBGV19YvCWOot5lXWsA,1101
325
325
  svc_infra/webhooks/router.py,sha256=6JvAVPMEth_xxHX-IsIOcyMgHX7g1H0OVxVXKLuMp9w,1596
326
- svc_infra/webhooks/service.py,sha256=hWgiJRXKBwKunJOx91C7EcLUkotDtD3Xp0RT6vj2IC0,1797
326
+ svc_infra/webhooks/service.py,sha256=hh-rw0otc00vipZ998XaV5mHsk0IDGYqon0FnhaGr60,2229
327
327
  svc_infra/webhooks/signing.py,sha256=NCwdZzmravUe7HVIK_uXK0qqf12FG-_MVsgPvOw6lsM,784
328
- svc_infra-0.1.626.dist-info/METADATA,sha256=OC4P-US0KYQFiLZZflkU5ndhPHcj4F0RhM1MxK0PBK0,8748
329
- svc_infra-0.1.626.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
330
- svc_infra-0.1.626.dist-info/entry_points.txt,sha256=6x_nZOsjvn6hRZsMgZLgTasaCSKCgAjsGhACe_CiP0U,48
331
- svc_infra-0.1.626.dist-info/RECORD,,
328
+ svc_infra-0.1.627.dist-info/METADATA,sha256=gFcK2j_knbFCz4OneRWDtbNHdFo0B335tqD9RamcWA8,8748
329
+ svc_infra-0.1.627.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
330
+ svc_infra-0.1.627.dist-info/entry_points.txt,sha256=6x_nZOsjvn6hRZsMgZLgTasaCSKCgAjsGhACe_CiP0U,48
331
+ svc_infra-0.1.627.dist-info/RECORD,,