1
0
forked from erp-dev/erp

feat: sse && multi_merchant completed

This commit is contained in:
2025-11-11 10:56:20 +08:00
parent b2078dfa46
commit 2aafb93aad
43 changed files with 2445 additions and 244 deletions

View File

@@ -0,0 +1,19 @@
from django.apps import AppConfig
from . import services
import signal, sys
class SseConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'sse'
def ready(self):
def cleanup_on_shutdown():
"""在接收到终止信号时设置关闭事件"""
from .views import _shutdown_event
_shutdown_event.set()
services.cleanup_all_connections()
sys.exit(0)
signal.signal(signal.SIGINT, lambda s, f: cleanup_on_shutdown())
signal.signal(signal.SIGTERM, lambda s, f: cleanup_on_shutdown())