From 00581b81365912fc7ea52f9b7b1a23a7a57e62ca Mon Sep 17 00:00:00 2001 From: abeizn Date: Fri, 12 Apr 2024 10:11:25 +0800 Subject: [PATCH] fix: db timeafter adjust (#7314) --- .../helpers/pluginhelper/api/api_collector_with_state.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/helpers/pluginhelper/api/api_collector_with_state.go b/backend/helpers/pluginhelper/api/api_collector_with_state.go index 982906f019f..a0f273ebd9a 100644 --- a/backend/helpers/pluginhelper/api/api_collector_with_state.go +++ b/backend/helpers/pluginhelper/api/api_collector_with_state.go @@ -135,7 +135,12 @@ func NewStatefulApiCollector(args RawDataSubTaskArgs) (*ApiCollectorStateManager currentTime := time.Now() oldState.LatestSuccessStart = ¤tTime - oldState.TimeAfter = syncPolicy.TimeAfter + if syncPolicy != nil { + oldState.TimeAfter = syncPolicy.TimeAfter + if syncPolicy.TimeAfter != nil && oldTimeAfter != nil && (oldTimeAfter).Before(*syncPolicy.TimeAfter) && !syncPolicy.FullSync { + oldState.TimeAfter = oldTimeAfter + } + } return &ApiCollectorStateManager{ RawDataSubTaskArgs: args,