fix: 启动时无需缓存测点
This commit is contained in:
parent
f9fc6f9d96
commit
10632d9cae
|
@ -1,16 +1,6 @@
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
from django.core.cache import cache
|
|
||||||
import threading
|
|
||||||
|
|
||||||
|
|
||||||
class EnmConfig(AppConfig):
|
class EnmConfig(AppConfig):
|
||||||
default_auto_field = 'django.db.models.BigAutoField'
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
name = 'apps.enm'
|
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()
|
|
||||||
|
|
Loading…
Reference in New Issue