_claim_due_events flipped rows to 'delivering' and committed before the HTTP call; if the process died between that commit and the outcome- recording transaction, the row stayed 'delivering' forever with no reclaim path -- a real gap, not previously documented as an accepted limitation. Give each claim a lease deadline (reusing next_attempt_at, since it's only otherwise meaningful for pending-status backoff scheduling) and sweep expired leases back to pending at the start of every dispatch cycle, before claiming new work. attempts is preserved so the count still reflects true history. Only leases past their deadline are touched, so a still-alive worker mid-delivery is never disturbed or double-processed.
41 lines
1.5 KiB
Python
41 lines
1.5 KiB
Python
from functools import lru_cache
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
|
|
|
mobilityops_env: str = "development"
|
|
mobilityops_demo_mode: bool = True
|
|
database_url: str = "postgresql+psycopg://mobilityops:mobilityops@db:5432/mobilityops"
|
|
knowledge_provider: str = "demo"
|
|
ragcore_base_url: str = "http://ragcore-api:8000"
|
|
ragcore_tenant: str = "northstar-mobility-demo"
|
|
ragcore_workspace: str = "mobilityops"
|
|
ragcore_collection: str = "internal-procedures"
|
|
ragcore_api_token: str = ""
|
|
ragcore_http_timeout_seconds: float = 5.0
|
|
n8n_webhook_url: str = "http://n8n:5678/webhook/mobilityops-return"
|
|
n8n_callback_token: str = "replace-me-n8n-callback-token"
|
|
n8n_dispatch_enabled: bool = True
|
|
n8n_dispatch_interval_seconds: float = 3.0
|
|
n8n_http_timeout_seconds: float = 5.0
|
|
n8n_max_attempts: int = 5
|
|
n8n_delivery_lease_seconds: float = 120.0
|
|
app_secret: str = "replace-in-production"
|
|
session_cookie_name: str = "mobilityops_session"
|
|
session_ttl_seconds: int = 60 * 60 * 8
|
|
session_cookie_secure: bool = False
|
|
seed_dir: str = "/app/seed"
|
|
knowledge_dir: str = "/app/knowledge/procedures"
|
|
mcp_hub_service_token: str = "replace-me-mcp-hub-token"
|
|
mcp_hub_registration_enabled: bool = False
|
|
cors_allow_origins: str = "http://localhost:1228"
|
|
demo_today: str = "2026-08-01"
|
|
|
|
|
|
@lru_cache
|
|
def get_settings() -> Settings:
|
|
return Settings()
|