fix: 启动时无需缓存测点

This commit is contained in:
caoqianming 2024-04-16 15:02:53 +08:00
parent f9fc6f9d96
commit 10632d9cae
1 changed files with 2 additions and 12 deletions

View File

@ -1,16 +1,6 @@
from django.apps import AppConfig
from django.core.cache import cache
import threading
class EnmConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'apps.enm'
def ready(self) -> None:
# 启动时缓存测点
if cache.get('cache_mpoint_task', True):
from .services import cache_mpoints
threading.Thread(target=cache_mpoints, daemon=True).start()
cache.set('cache_mpoint_task', False, timeout=30)
return super().ready()
default_auto_field = "django.db.models.BigAutoField"
name = "apps.enm"