mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 15:31:05 +08:00
fix(connector_service): add TIMEZONE setting and correct interval log… (#14446)
### What problem does this PR solve? ### Type of change - [v] Bug Fix (non-breaking change which fixes an issue) Co-authored-by: wiratama <dafa.wiratama@bankraya.co.id>
This commit is contained in:
@@ -29,6 +29,7 @@ from api.db.services.document_service import DocMetadataService
|
||||
from api.utils.common import hash128
|
||||
from common.misc_utils import get_uuid
|
||||
from common.constants import TaskStatus
|
||||
from common.settings import TIMEZONE
|
||||
from common.time_utils import current_timestamp, timestamp_to_date
|
||||
|
||||
class ConnectorService(CommonService):
|
||||
@@ -179,14 +180,14 @@ class SyncLogsService(CommonService):
|
||||
else:
|
||||
database_type = os.getenv("DB_TYPE", "mysql")
|
||||
if "postgres" in database_type.lower():
|
||||
interval_expr = SQL("make_interval(mins => t2.refresh_freq)")
|
||||
expr = SQL(f"NOW() AT TIME ZONE '{TIMEZONE}' - make_interval(mins => t2.refresh_freq)")
|
||||
else:
|
||||
interval_expr = SQL("INTERVAL `t2`.`refresh_freq` MINUTE")
|
||||
expr = SQL("NOW() - INTERVAL `t2`.`refresh_freq` MINUTE")
|
||||
query = query.where(
|
||||
Connector.input_type == InputType.POLL,
|
||||
Connector.status == TaskStatus.SCHEDULE,
|
||||
cls.model.status == TaskStatus.SCHEDULE,
|
||||
cls.model.update_date < (fn.NOW() - interval_expr)
|
||||
cls.model.update_date < expr
|
||||
)
|
||||
|
||||
query = query.distinct().order_by(cls.model.update_time.desc())
|
||||
|
||||
@@ -43,6 +43,8 @@ import memory.utils.es_conn as memory_es_conn
|
||||
import memory.utils.infinity_conn as memory_infinity_conn
|
||||
import memory.utils.ob_conn as memory_ob_conn
|
||||
|
||||
TIMEZONE = os.getenv("TZ", "Asia/Shanghai")
|
||||
|
||||
LLM = None
|
||||
LLM_FACTORY = None
|
||||
LLM_BASE_URL = None
|
||||
|
||||
Reference in New Issue
Block a user