mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 14:45:53 +08:00
update celery beat scheduler time to env (#6352)
This commit is contained in:
parent
06fcc0c650
commit
7c397f5722
@ -256,3 +256,7 @@ WORKFLOW_CALL_MAX_DEPTH=5
|
|||||||
# App configuration
|
# App configuration
|
||||||
APP_MAX_EXECUTION_TIME=1200
|
APP_MAX_EXECUTION_TIME=1200
|
||||||
APP_MAX_ACTIVE_REQUESTS=0
|
APP_MAX_ACTIVE_REQUESTS=0
|
||||||
|
|
||||||
|
|
||||||
|
# Celery beat configuration
|
||||||
|
CELERY_BEAT_SCHEDULER_TIME=1
|
@ -23,6 +23,7 @@ class SecurityConfig(BaseSettings):
|
|||||||
default=24,
|
default=24,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class AppExecutionConfig(BaseSettings):
|
class AppExecutionConfig(BaseSettings):
|
||||||
"""
|
"""
|
||||||
App Execution configs
|
App Execution configs
|
||||||
@ -435,6 +436,13 @@ class ImageFormatConfig(BaseSettings):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class CeleryBeatConfig(BaseSettings):
|
||||||
|
CELERY_BEAT_SCHEDULER_TIME: int = Field(
|
||||||
|
description='the time of the celery scheduler, default to 1 day',
|
||||||
|
default=1,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class FeatureConfig(
|
class FeatureConfig(
|
||||||
# place the configs in alphabet order
|
# place the configs in alphabet order
|
||||||
AppExecutionConfig,
|
AppExecutionConfig,
|
||||||
@ -462,5 +470,6 @@ class FeatureConfig(
|
|||||||
|
|
||||||
# hosted services config
|
# hosted services config
|
||||||
HostedServiceConfig,
|
HostedServiceConfig,
|
||||||
|
CeleryBeatConfig,
|
||||||
):
|
):
|
||||||
pass
|
pass
|
||||||
|
@ -43,15 +43,15 @@ def init_app(app: Flask) -> Celery:
|
|||||||
"schedule.clean_embedding_cache_task",
|
"schedule.clean_embedding_cache_task",
|
||||||
"schedule.clean_unused_datasets_task",
|
"schedule.clean_unused_datasets_task",
|
||||||
]
|
]
|
||||||
|
day = app.config["CELERY_BEAT_SCHEDULER_TIME"]
|
||||||
beat_schedule = {
|
beat_schedule = {
|
||||||
'clean_embedding_cache_task': {
|
'clean_embedding_cache_task': {
|
||||||
'task': 'schedule.clean_embedding_cache_task.clean_embedding_cache_task',
|
'task': 'schedule.clean_embedding_cache_task.clean_embedding_cache_task',
|
||||||
'schedule': timedelta(days=1),
|
'schedule': timedelta(days=day),
|
||||||
},
|
},
|
||||||
'clean_unused_datasets_task': {
|
'clean_unused_datasets_task': {
|
||||||
'task': 'schedule.clean_unused_datasets_task.clean_unused_datasets_task',
|
'task': 'schedule.clean_unused_datasets_task.clean_unused_datasets_task',
|
||||||
'schedule': timedelta(minutes=3),
|
'schedule': timedelta(days=day),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
celery_app.conf.update(
|
celery_app.conf.update(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user