Explorar el Código

fix timezone, use UTC instead of system tz

Signed-off-by: r2k1 <yokree@gmail.com>
r2k1 hace 3 años
padre
commit
9496b797ff
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      pkg/costmodel/csv_export.go

+ 2 - 2
pkg/costmodel/csv_export.go

@@ -45,10 +45,10 @@ func UpdateCSVWorker(ctx context.Context, storage CloudStorage, model Allocation
 				// it's background worker, log error and carry on, maybe next time it will work
 				log.Errorf("Error updating CSV: %s", err)
 			}
-			now := time.Now()
+			now := time.Now().UTC()
 			// next launch is at 00:10 UTC tomorrow
 			// extra 10 minutes is to let prometheus to collect all the data for the previous day
-			nextRunAt = time.Date(now.Year(), now.Month(), now.Day(), 0, 10, 0, 0, time.UTC).AddDate(0, 0, 1)
+			nextRunAt = time.Date(now.Year(), now.Month(), now.Day(), 0, 10, 0, 0, now.Location()).AddDate(0, 0, 1)
 		}
 	}
 }