Skip to content

Commit 60a3f76

Browse files
GeorgEchterlingGeorg Echterling
and
Georg Echterling
authored
fix: Avoid false warning about UTC timestamps (#505)
If the JDBC customization is already correctly configured, `SchedulerClient.Builder.build` should not instantiate an unused incorrectly configured one. ## Fixes Instantiating a `SchedulerClient` on MariaDB always logged the UTC warning, even when using a correctly configured JDBC customization: ```java SchedulerClient.Builder.create(dataSource) .jdbcCustomization(AutodetectJdbcCustomization(dataSource, true)) .build() ``` ``` 2024-06-21T15:44:33.427+02:00 WARN 57277 --- [ restartedMain] c.g.k.s.j.A.utc_warning : MariaDB-schema does not support persistent timezones. It is recommended to store time in UTC to avoid issues with for example DST. For first time users, use setting 'alwaysPersistTimestampInUtc' to achieve this. Users upgrading from a version prior to v14.0.0 can either silence this logger, or perform a controlled upgrade to UTC timestamps. All old instances of the scheduler must be stopped and timestamps migrated to UTC before starting again, using 'alwaysPersistTimestampInUtc=true'. ``` (I did not create a separate issue for this.) --- cc @kagkarlsson Co-authored-by: Georg Echterling <[email protected]>
1 parent 1b52ac3 commit 60a3f76

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

db-scheduler/src/main/java/com/github/kagkarlsson/scheduler/SchedulerClient.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,15 @@ public SchedulerClient build() {
219219
TaskResolver taskResolver = new TaskResolver(StatsRegistry.NOOP, knownTasks);
220220
final SystemClock clock = new SystemClock();
221221

222+
final JdbcCustomization jdbcCustomization =
223+
ofNullable(this.jdbcCustomization)
224+
.orElseGet(() -> new AutodetectJdbcCustomization(dataSource));
225+
222226
TaskRepository taskRepository =
223227
new JdbcTaskRepository(
224228
dataSource,
225229
false,
226-
ofNullable(jdbcCustomization).orElse(new AutodetectJdbcCustomization(dataSource)),
230+
jdbcCustomization,
227231
tableName,
228232
taskResolver,
229233
new SchedulerClientName(),

0 commit comments

Comments
 (0)