Skip to content

Commit 63e4645

Browse files
committed
fix: Fix the defect that the knowledge base vectorization time is inconsistent with the system
--bug=1052060 --user=王孝刚 【知识库】-同步Web站点知识库,同步状态的时间与当前时区不一致,晚8小时 https://www.tapd.cn/57709429/s/1651754
1 parent bf12d2b commit 63e4645

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

apps/common/event/listener_manage.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import logging
1010
import os
1111
import threading
12+
import datetime
1213
import traceback
1314
from typing import List
1415

@@ -229,9 +230,11 @@ def update_status(query_set: QuerySet, taskType: TaskType, state: State):
229230
next_index = taskType.value + 1
230231
current_index = taskType.value
231232
status_number = state.value
233+
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f') + '+00'
232234
params_dict = {'${bit_number}': bit_number, '${up_index}': up_index,
233235
'${status_number}': status_number, '${next_index}': next_index,
234-
'${table_name}': query_set.model._meta.db_table, '${current_index}': current_index}
236+
'${table_name}': query_set.model._meta.db_table, '${current_index}': current_index,
237+
'${current_time}': current_time}
235238
for key in params_dict:
236239
_value_ = params_dict[key]
237240
exec_sql = exec_sql.replace(key, str(_value_))

apps/dataset/sql/update_paragraph_status.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ status_meta = jsonb_set (
66
"${table_name}".status_meta,
77
'{state_time,${current_index}}',
88
jsonb_set (
9-
COALESCE ( "${table_name}".status_meta #> '{state_time,${current_index}}', jsonb_build_object ( '${status_number}', now( ) ) ),
9+
COALESCE ( "${table_name}".status_meta #> '{state_time,${current_index}}', jsonb_build_object ( '${status_number}', '${current_time}' ) ),
1010
'{${status_number}}',
11-
CONCAT ( '"', now( ), '"' ) :: JSONB
11+
CONCAT ( '"', '${current_time}', '"' ) :: JSONB
1212
)
1313
)

0 commit comments

Comments
 (0)