From 6a358d2f313628ff05746ba794ffe1478e22e3b5 Mon Sep 17 00:00:00 2001 From: Chandra shekar Varkala Date: Tue, 25 Oct 2022 14:16:29 +0530 Subject: [PATCH] chore: cleanup unused/obsolete code --- jobsdb/unionQuery.go | 2 -- services/db/nullRecovery.go | 4 ++-- services/db/recovery.go | 12 +++++------- services/multitenant/noop.go | 25 ------------------------- 4 files changed, 7 insertions(+), 36 deletions(-) delete mode 100644 services/multitenant/noop.go diff --git a/jobsdb/unionQuery.go b/jobsdb/unionQuery.go index b44989ba0da..59330c31a05 100644 --- a/jobsdb/unionQuery.go +++ b/jobsdb/unionQuery.go @@ -287,7 +287,6 @@ func (*MultiTenantHandleT) getInitialSingleWorkspaceQueryString(ds dataSetT, con } if len(customValFilters) > 0 && !conditions.IgnoreCustomValFiltersInQuery { - // mj.assert(!getAll, "getAll is true") customValQuery = " AND " + constructQueryOR("jobs.custom_val", customValFilters) } else { @@ -295,7 +294,6 @@ func (*MultiTenantHandleT) getInitialSingleWorkspaceQueryString(ds dataSetT, con } if len(parameterFilters) > 0 { - // mj.assert(!getAll, "getAll is true") sourceQuery += " AND " + constructParameterJSONQuery("jobs", parameterFilters) } else { sourceQuery = "" diff --git a/services/db/nullRecovery.go b/services/db/nullRecovery.go index 34cf2ffedb8..a126e3024fa 100644 --- a/services/db/nullRecovery.go +++ b/services/db/nullRecovery.go @@ -6,7 +6,7 @@ import ( "github.com/rudderlabs/rudder-server/config" ) -// HandleNullRecovery decides the recovery Mode (normal/migration) in which app should run +// HandleNullRecovery decides the recovery Mode (normal/degraded) in which app should run func HandleNullRecovery(forceNormal, forceDegraded bool, currTime int64, appType string) { enabled := config.GetBool("recovery.enabled", true) if !enabled { @@ -18,7 +18,7 @@ func HandleNullRecovery(forceNormal, forceDegraded bool, currTime int64, appType if forceMode != "" { recoveryData.Mode = forceMode } else if recoveryData.Mode != normalMode { - // If no mode is forced (through env or cli) and if previous mode is migration then setting server mode to normal. + // If no mode is forced (through env or cli) then setting server mode to normal. recoveryData.Mode = normalMode } recoveryHandler := NewRecoveryHandler(&recoveryData) diff --git a/services/db/recovery.go b/services/db/recovery.go index 0254e918794..2af7cfcc8d9 100644 --- a/services/db/recovery.go +++ b/services/db/recovery.go @@ -32,13 +32,11 @@ var ( // RecoveryDataT : DS to store the recovery process data type RecoveryDataT struct { - StartTimes []int64 - ReadableStartTimes []string - DegradedModeStartTimes []int64 - ReadableDegradedModeStartTimes []string - MigrationModeStartTimes []int64 - ReadableMigrationModeStartTimes []string - Mode string + StartTimes []int64 + ReadableStartTimes []string + DegradedModeStartTimes []int64 + ReadableDegradedModeStartTimes []string + Mode string } var pkgLogger logger.Logger diff --git a/services/multitenant/noop.go b/services/multitenant/noop.go deleted file mode 100644 index 45808e0a133..00000000000 --- a/services/multitenant/noop.go +++ /dev/null @@ -1,25 +0,0 @@ -package multitenant - -import "time" - -var NOOP = &noop{} - -type noop struct{} - -func (*noop) CalculateSuccessFailureCounts(_, _ string, _, _ bool) {} -func (*noop) AddToInMemoryCount(_, _ string, _ int, _ string) {} -func (*noop) RemoveFromInMemoryCount(_, _ string, _ int, _ string) {} -func (*noop) ReportProcLoopAddStats(_ map[string]map[string]int, _ string) {} -func (*noop) AddWorkspaceToLatencyMap(_, _ string) {} -func (*noop) UpdateWorkspaceLatencyMap(_, _ string, _ float64) {} -func (*noop) Start() error { return nil } -func (*noop) Stop() {} -func (*noop) Status() map[string]map[string]map[string]int { - return map[string]map[string]map[string]int{} -} - -func (*noop) GetRouterPickupJobs(_ string, _ int, _ time.Duration, jobQueryBatchSize int, _ float64) ( - map[string]int, map[string]float64, -) { - return map[string]int{"0": jobQueryBatchSize}, map[string]float64{} -}