mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 05:42:19 +00:00
fix(db): track the time-zone pin's failure log as background work
The pin's SET on connect runs detached; its failure line now registers with the background-task tracker like every other detached writer. The coach thread test reads the new budget reset copy.
This commit is contained in:
1 parent
576ff9a444
commit
7a43131883
2 files changed
+10
-4
No files matched your search
@@ -699,7 +699,7 @@ describe("<MessageThread>", () => {
|
||||
/>,
|
||||
);
|
||||
expect(html).toContain(
|
||||
"Daily limit reached. The budget refreshes at midnight UTC.",
|
||||
"Daily limit reached. The budget refreshes at midnight in your time zone.",
|
||||
);
|
||||
// v1.4.33 IW7 — fallback copy rewritten ("AI provider" -> "Insights
|
||||
// provider"). Both old and new strings should be absent here when
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
*/
|
||||
import type { Pool, PoolClient } from "pg";
|
||||
|
||||
import { trackBackgroundTask } from "@/lib/logging/background-tasks";
|
||||
|
||||
/**
|
||||
* Whether the app may send the libpq `options` startup parameter at all.
|
||||
*
|
||||
@@ -62,8 +64,12 @@ export function timeZoneSessionOptions(): string | undefined {
|
||||
export function pinTimeZoneOnConnect(pool: Pool): void {
|
||||
if (!sessionOptionsDisabled()) return;
|
||||
pool.on("connect", (client: PoolClient) => {
|
||||
client.query(SET_SESSION_TIME_ZONE).catch((err: unknown) => {
|
||||
console.error("[db] Could not pin the session time zone:", err);
|
||||
});
|
||||
trackBackgroundTask(
|
||||
client.query(SET_SESSION_TIME_ZONE).catch((err: unknown) => {
|
||||
// The boot check reports a session that is not in UTC; this names
|
||||
// the cause when the statement itself failed.
|
||||
console.error("[db] Could not pin the session time zone:", err);
|
||||
}),
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user