Commit 7b825519 authored by Kevin Di Lallo's avatar Kevin Di Lallo
Browse files

gc fixes

parent c855a9e4
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -158,8 +158,8 @@ repo:
      enabled: true
      # garbage collection interval (duration string)
      interval: 1m
      # run garbage collection on startup
      run-on-startup: true
      # run garbage collection on start
      run-on-start: true
      # Redis configuration
      redis:
        # enable redis garbage collection
@@ -170,7 +170,8 @@ repo:
        enabled: true
        # list of databases that must not be removed
        exceptions:
          - my_db_to_keep
        #   - my_db_to_keep
        #   - my_other_db_to_keep
      # Postgis configuration
      postgis:
        # enable postgis garbage collection
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ spec:
          env:
            {{- range $key, $value := .Values.image.env }}
            - name: {{ $key }}
              value: {{ $value | quote }}
              value: {{ $value }}
            {{- end }}
            {{- range $key, $value := .Values.image.envSecret }}
            - name: {{ $key }}
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ func Init() (err error) {
		// Retrieve run-on-start flag from environment variable
		runOnStartStr := strings.TrimSpace(os.Getenv("MEEP_GC_RUN_ON_START"))
		runOnStart, err := strconv.ParseBool(runOnStartStr)
		if err == nil {
		if err != nil {
			runOnStart = false
		}
		log.Info("MEEP_GC_RUN_ON_START: ", runOnStartStr)
+10 −10
Original line number Diff line number Diff line
@@ -54,9 +54,9 @@ type GarbageCollector struct {
const maxRetryCount = 2

var exceptionList []string = []string{
	"-internal",
	"global-sandbox-metrics",
	"global-session-metrics",
	"_internal",
	"global_sandbox_metrics",
	"global_session_metrics",
}

// NewGarbageCollector - Creates and initialize a Garbage Collector instance
@@ -277,7 +277,7 @@ func (gc *GarbageCollector) gcInfluxData() {
		// Ignore DB names from default exception list
		match := false
		for _, exception := range exceptionList {
			if dbNameDashes == exception {
			if dbName == exception {
				match = true
				break
			}
@@ -288,7 +288,7 @@ func (gc *GarbageCollector) gcInfluxData() {

		// Ignore DB names from user-provided exception list
		for _, exception := range gc.cfg.InfluxExceptions {
			if dbNameDashes == exception {
			if dbName == exception {
				match = true
				break
			}
@@ -310,11 +310,11 @@ func (gc *GarbageCollector) gcInfluxData() {

		// Flush database if no match found
		log.Info("Clearing inactive Influx database: ", dbName)
		// q = influx.NewQuery("DROP DATABASE "+dbName, "", "")
		// _, err := (*gc.influxClient).Query(q)
		// if err != nil {
		// 	log.Error("Failed to drop influx database with error: ", err.Error())
		// }
		q = influx.NewQuery("DROP DATABASE "+dbName, "", "")
		_, err := (*gc.influxClient).Query(q)
		if err != nil {
			log.Error("Failed to drop influx database with error: ", err.Error())
		}
	}
}