fix: throttle jt808 registration touches

This commit is contained in:
lingniu
2026-07-02 10:24:44 +08:00
parent a66f765e16
commit e7d024405a
6 changed files with 111 additions and 29 deletions

View File

@@ -138,7 +138,10 @@ func buildIdentityResolver(ctx context.Context, logger *slog.Logger) (identity.R
}
table := env("VEHICLE_IDENTITY_TABLE", "vehicle_identity_binding")
logger.Info("identity mysql resolver enabled", "table", table)
return identity.NewMySQLResolver(db, table), func() { _ = db.Close() }, nil
locationTouchInterval := time.Duration(envInt("JT808_REGISTRATION_LOCATION_TOUCH_INTERVAL_SECONDS", 600)) * time.Second
return identity.NewMySQLResolverWithOptions(db, table, identity.MySQLResolverOptions{
LocationTouchInterval: locationTouchInterval,
}), func() { _ = db.Close() }, nil
}
func buildSink(ctx context.Context, logger *slog.Logger) (eventbus.Sink, error) {