fix: reconcile Huihui payment callbacks after provider confirmation
This commit is contained in:
@@ -282,6 +282,19 @@ def close_expired_pending_orders_job():
|
||||
db.close()
|
||||
|
||||
|
||||
def reconcile_huihui_org_notices_job():
|
||||
db = SessionLocal()
|
||||
try:
|
||||
count = routers.tokens.reconcile_huihui_org_notices(db)
|
||||
if count:
|
||||
logger.info("Confirmed %s Huihui organization payment notice(s)", count)
|
||||
except Exception as exc:
|
||||
db.rollback()
|
||||
logger.warning("Failed to reconcile Huihui organization payment notices: %s", exc)
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
def start_maintenance_scheduler():
|
||||
global maintenance_scheduler
|
||||
|
||||
@@ -305,6 +318,13 @@ def start_maintenance_scheduler():
|
||||
max_instances=1,
|
||||
coalesce=True,
|
||||
)
|
||||
maintenance_scheduler.add_job(
|
||||
reconcile_huihui_org_notices_job,
|
||||
trigger=IntervalTrigger(seconds=30),
|
||||
id="reconcile_huihui_org_notices",
|
||||
max_instances=1,
|
||||
coalesce=True,
|
||||
)
|
||||
maintenance_scheduler.start()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user