Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: failed open for parse location (#8440)

rebelice4102b61861b1
diff --git a/backend/plugin/db/mysql/sync.go b/backend/plugin/db/mysql/sync.go
index 642fa1e907..c7dd9fe0d8 100644
--- a/backend/plugin/db/mysql/sync.go
+++ b/backend/plugin/db/mysql/sync.go
@@ -520,6 +520,16 @@ func (driver *Driver) SyncSlowQuery(ctx context.Context, logDateTs time.Time) (m
return nil, util.FormatErrorWithQuery(err, timeZoneQuery)
}
+ location, err := time.LoadLocation(timeZone)
+ if err != nil {
+ slog.Debug("failed to load time zone", slog.String("timeZone", timeZone), log.BBError(err))
+ location, err = time.LoadLocation("Local")
+ if err != nil {
+ // This should never happen
+ slog.Debug("failed to load time zone", slog.String("timeZone", "Local"), log.BBError(err))
+ }
+ }
+
logs := make([]*slowLog, 0, db.SlowQueryMaxSamplePerDay)
query := `
SELECT
@@ -559,10 +569,6 @@ func (driver *Driver) SyncSlowQuery(ctx context.Context, logDateTs time.Time) (m
return nil, err
}
- location, err := time.LoadLocation(timeZone)
- if err != nil {
- return nil, err
- }
startTimeTs, err := time.ParseInLocation("2006-01-02 15:04:05.999999", startTime, location)
if err != nil {
return nil, err