Skip to content

1223: Warn when web and database server time differ#7815

Open
labkey-nicka wants to merge 4 commits into
release26.7-SNAPSHOTfrom
26.7_fb_time_diff_1223
Open

1223: Warn when web and database server time differ#7815
labkey-nicka wants to merge 4 commits into
release26.7-SNAPSHOTfrom
26.7_fb_time_diff_1223

Conversation

@labkey-nicka

@labkey-nicka labkey-nicka commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Rationale

This addresses #1223 by adding a configuration warning when the web server and database server times differ.

Related Pull Requests

Changes

  • Introduce SqlDialect.getServerDatabaseTimeDifference() to centralize logic for checking time difference
  • Capture results in ServerDatabaseTimeDifference record
  • Add configuration warning for Postgres
  • Update admin page and experiment material to use new logic
  • Refactor usages of unsafe()

@labkey-nicka labkey-nicka requested a review from labkey-adam July 6, 2026 21:22
@labkey-nicka labkey-nicka self-assigned this Jul 6, 2026

if (_incrementalUpdateDisabled)
_log.warn("Incremental update disabled for samples. Web and database server time differ by {} seconds which exceeds the threshold of {} seconds. You may experience degraded sample query performance.", deltaSeconds, thresholdSeconds);
_log.warn("Incremental update disabled for samples. Web and database server time differ by {} seconds which exceeds the threshold of {} seconds. You may experience degraded sample query performance.", difference.getSeconds(), SqlDialect.TIME_DIFFERENCE_WARNING_SECONDS);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we have the admin warning, so it's okay to log this only once

_incrementalUpdateDisabled = deltaSeconds > thresholdSeconds;
DbScope scope = DbScope.getLabKeyScope();
SqlDialect.ServerDatabaseTimeDifference difference = SqlDialect.getServerDatabaseTimeDifference(scope);
_incrementalUpdateDisabled = difference.exceedsWarningThreshold();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only way to reset this is to restart that web server, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants