From 4d60f7c174ddfb6d5d1c4c5b482f88cb8e5f2232 Mon Sep 17 00:00:00 2001 From: Kassian Sun Date: Tue, 6 Jun 2023 10:02:13 +0800 Subject: [PATCH] [migration] info api returns repeat in labels --- plugin/migration/api.go | 8 ++++++++ plugin/migration/comparison_api.go | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/plugin/migration/api.go b/plugin/migration/api.go index a999bc2b..a134a51a 100644 --- a/plugin/migration/api.go +++ b/plugin/migration/api.go @@ -129,6 +129,7 @@ func (h *APIHandler) getDataMigrationTaskInfo(w http.ResponseWriter, req *http.R completedIndices++ } } + cfg := global.MustLookup("cluster_migration_config") if migrationConfig, ok := cfg.(*DispatcherConfig); ok { if obj.Metadata.Labels == nil { @@ -139,6 +140,13 @@ func (h *APIHandler) getDataMigrationTaskInfo(w http.ResponseWriter, req *http.R "index_name": migrationConfig.LogIndexName, } } + + _, repeatStatus, err := h.calcRepeatingStatus(&obj) + if err != nil { + log.Warnf("failed to calc repeat info, err: %v", err) + } + obj.Metadata.Labels["repeat"] = repeatStatus + obj.ConfigString = util.MustToJSON(taskConfig) obj.Metadata.Labels["completed_indices"] = completedIndices h.WriteJSON(w, obj, http.StatusOK) diff --git a/plugin/migration/comparison_api.go b/plugin/migration/comparison_api.go index 573f2804..11df430f 100644 --- a/plugin/migration/comparison_api.go +++ b/plugin/migration/comparison_api.go @@ -97,6 +97,13 @@ func (h *APIHandler) getDataComparisonTaskInfo(w http.ResponseWriter, req *http. "index_name": migrationConfig.LogIndexName, } } + + _, repeatStatus, err := h.calcRepeatingStatus(&obj) + if err != nil { + log.Warnf("failed to calc repeat info, err: %v", err) + } + obj.Metadata.Labels["repeat"] = repeatStatus + obj.ConfigString = util.MustToJSON(taskConfig) obj.Metadata.Labels["completed_indices"] = completedIndices h.WriteJSON(w, obj, http.StatusOK)