- Add test environment to __init__.py for all eveai services
- Add postgresql certificate to secrets for secure communication in staging and production environments - Adapt for TLS communication with PostgreSQL - Adapt tasks to handle invalid connections from the connection pool - Migrate to psycopg3 for connection to PostgreSQL
This commit is contained in:
@@ -3,8 +3,9 @@ import os
|
||||
from datetime import datetime as dt, timezone as tz, datetime
|
||||
|
||||
from flask import current_app
|
||||
from celery import states
|
||||
from sqlalchemy import or_, and_, text
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from sqlalchemy.exc import SQLAlchemyError, InterfaceError, OperationalError
|
||||
from common.extensions import db
|
||||
from common.models.user import Tenant
|
||||
from common.models.entitlements import BusinessEventLog, LicenseUsage, License
|
||||
@@ -20,8 +21,8 @@ def ping():
|
||||
return 'pong'
|
||||
|
||||
|
||||
@current_celery.task(name='persist_business_events', queue='entitlements')
|
||||
def persist_business_events(log_entries):
|
||||
@current_celery.task(bind=True, name='persist_business_events', queue='entitlements', autoretry_for=(InterfaceError, OperationalError), retry_backoff=True, retry_jitter=True, max_retries=5)
|
||||
def persist_business_events(self, log_entries):
|
||||
"""
|
||||
Persist multiple business event logs to the database in a single transaction
|
||||
|
||||
|
||||
Reference in New Issue
Block a user