Implement durable image processing pipeline with outbox and recovery
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
import psycopg
|
||||
from psycopg.rows import dict_row
|
||||
|
||||
|
||||
def connect_db():
|
||||
return psycopg.connect(
|
||||
host=os.getenv("PGHOST", "postgres"),
|
||||
port=int(os.getenv("PGPORT", "5432")),
|
||||
dbname=os.getenv("PGDATABASE", "messenger"),
|
||||
user=os.getenv("PGUSER", "messenger"),
|
||||
password=os.environ["PGPASSWORD"],
|
||||
connect_timeout=3,
|
||||
autocommit=True,
|
||||
row_factory=dict_row,
|
||||
options=(
|
||||
"-c statement_timeout=3000 "
|
||||
"-c lock_timeout=2000 "
|
||||
"-c idle_in_transaction_session_timeout=60000"
|
||||
),
|
||||
)
|
||||
Reference in New Issue
Block a user