socket io setup

This commit is contained in:
Beverly Nguyen
2025-04-09 16:56:42 -07:00
parent 0792ea123f
commit f8726ca6b7
12 changed files with 238 additions and 268 deletions

View File

@@ -131,3 +131,18 @@ def utc_now():
def debug_not_production(msg):
if os.getenv("NOTIFY_ENVIRONMENT") not in ["production"]:
current_app.logger.info(msg)
def emit_job_update_summary(job):
from app import socketio
current_app.logger.info(f"Emitting summary for job {job.id}")
socketio.emit(
"job_updated",
{
"job_id": str(job.id),
"job_status": job.job_status,
"notification_count": job.notification_count,
},
room=f"job-{job.id}"
)