@teamvibe/poller 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/config.d.ts CHANGED
@@ -28,7 +28,7 @@ declare const configSchema: z.ZodObject<{
28
28
  BASE_BRAIN_PATH: z.ZodDefault<z.ZodString>;
29
29
  BRAIN_AUTO_UPDATE: z.ZodEffects<z.ZodDefault<z.ZodString>, boolean, string | undefined>;
30
30
  BRAIN_UPDATE_COOLDOWN_MS: z.ZodDefault<z.ZodNumber>;
31
- POLLER_TZ: z.ZodDefault<z.ZodString>;
31
+ POLLER_TZ: z.ZodOptional<z.ZodString>;
32
32
  HEARTBEAT_CRON: z.ZodDefault<z.ZodString>;
33
33
  MAINTENANCE_CRON: z.ZodDefault<z.ZodString>;
34
34
  MAINTENANCE_ENABLED: z.ZodEffects<z.ZodDefault<z.ZodString>, boolean, string | undefined>;
@@ -59,7 +59,6 @@ declare const configSchema: z.ZodObject<{
59
59
  BASE_BRAIN_PATH: string;
60
60
  BRAIN_AUTO_UPDATE: boolean;
61
61
  BRAIN_UPDATE_COOLDOWN_MS: number;
62
- POLLER_TZ: string;
63
62
  HEARTBEAT_CRON: string;
64
63
  MAINTENANCE_CRON: string;
65
64
  MAINTENANCE_ENABLED: boolean;
@@ -68,6 +67,7 @@ declare const configSchema: z.ZodObject<{
68
67
  SQS_QUEUE_URL?: string | undefined;
69
68
  SESSIONS_TABLE?: string | undefined;
70
69
  TEAMVIBE_POLLER_TOKEN?: string | undefined;
70
+ POLLER_TZ?: string | undefined;
71
71
  }, {
72
72
  AWS_REGION?: string | undefined;
73
73
  SQS_QUEUE_URL?: string | undefined;
@@ -130,7 +130,6 @@ export declare const config: {
130
130
  BASE_BRAIN_PATH: string;
131
131
  BRAIN_AUTO_UPDATE: boolean;
132
132
  BRAIN_UPDATE_COOLDOWN_MS: number;
133
- POLLER_TZ: string;
134
133
  HEARTBEAT_CRON: string;
135
134
  MAINTENANCE_CRON: string;
136
135
  MAINTENANCE_ENABLED: boolean;
@@ -139,5 +138,6 @@ export declare const config: {
139
138
  SQS_QUEUE_URL?: string | undefined;
140
139
  SESSIONS_TABLE?: string | undefined;
141
140
  TEAMVIBE_POLLER_TOKEN?: string | undefined;
141
+ POLLER_TZ?: string | undefined;
142
142
  };
143
143
  export {};
package/dist/config.js CHANGED
@@ -44,13 +44,14 @@ const configSchema = z.object({
44
44
  .transform((v) => v.toLowerCase() === 'true'),
45
45
  BRAIN_UPDATE_COOLDOWN_MS: z.coerce.number().default(300000), // 5 minutes
46
46
  // Brain heartbeat & maintenance (cron-based)
47
- // POLLER_TZ: IANA timezone used to interpret HEARTBEAT_CRON & MAINTENANCE_CRON.
48
- // Default Europe/Prague — current fleet is CZ-based; ensures `30 3 * * *`
49
- // means "03:30 local night," not "03:30 UTC = 05:30 CEST." DST is handled
50
- // by croner automatically. Override with `POLLER_TZ=UTC` (or any IANA name).
51
- POLLER_TZ: z.string().default('Europe/Prague'),
47
+ // POLLER_TZ: optional IANA timezone for HEARTBEAT_CRON & MAINTENANCE_CRON.
48
+ // When unset, croner uses the host system timezone (e.g. `Europe/Prague` on
49
+ // a CZ Mac mini, `UTC` on a default Railway container). Set explicitly
50
+ // (e.g. `POLLER_TZ=Europe/Prague` on Railway) when the host TZ doesn't match
51
+ // the intended cron interpretation. DST is handled by croner automatically.
52
+ POLLER_TZ: z.string().optional(),
52
53
  HEARTBEAT_CRON: z.string().default('0 */6 * * *'), // Every 6 hours
53
- MAINTENANCE_CRON: z.string().default('30 3 * * *'), // Daily at 03:30 in POLLER_TZ
54
+ MAINTENANCE_CRON: z.string().default('30 3 * * *'), // Daily at 03:30 in POLLER_TZ (or host TZ)
54
55
  MAINTENANCE_ENABLED: z.string().default('true').transform((v) => v.toLowerCase() === 'true'),
55
56
  // Auto-update settings
56
57
  AUTO_UPDATE_POLICY: z.enum(['patch', 'minor', 'off']).default('patch'),
@@ -113,14 +113,21 @@ export function startHeartbeatLoop(processMessageFn) {
113
113
  logger.info('[Heartbeat] Maintenance disabled via config');
114
114
  return;
115
115
  }
116
+ // Croner uses the host system TZ when `timezone` option is omitted.
117
+ // Build options conditionally so undefined POLLER_TZ becomes "host TZ"
118
+ // rather than overriding it with `timezone: undefined`.
119
+ const cronOpts = config.POLLER_TZ
120
+ ? { timezone: config.POLLER_TZ, protect: true }
121
+ : { protect: true };
122
+ const tzLabel = config.POLLER_TZ ?? `host (${Intl.DateTimeFormat().resolvedOptions().timeZone})`;
116
123
  // Heartbeat cron — frequent, lightweight
117
- logger.info(`[Heartbeat] Starting heartbeat cron: "${config.HEARTBEAT_CRON}" (tz: ${config.POLLER_TZ})`);
118
- heartbeatJob = new Cron(config.HEARTBEAT_CRON, { timezone: config.POLLER_TZ, protect: true }, async () => {
124
+ logger.info(`[Heartbeat] Starting heartbeat cron: "${config.HEARTBEAT_CRON}" (tz: ${tzLabel})`);
125
+ heartbeatJob = new Cron(config.HEARTBEAT_CRON, cronOpts, async () => {
119
126
  await runHeartbeatJob(processMessageFn);
120
127
  });
121
128
  // Maintenance cron — daily, heavy (consolidation, memory cleanup)
122
- logger.info(`[Maintenance] Starting maintenance cron: "${config.MAINTENANCE_CRON}" (tz: ${config.POLLER_TZ})`);
123
- maintenanceJob = new Cron(config.MAINTENANCE_CRON, { timezone: config.POLLER_TZ, protect: true }, async () => {
129
+ logger.info(`[Maintenance] Starting maintenance cron: "${config.MAINTENANCE_CRON}" (tz: ${tzLabel})`);
130
+ maintenanceJob = new Cron(config.MAINTENANCE_CRON, cronOpts, async () => {
124
131
  await runMaintenanceJob(processMessageFn);
125
132
  });
126
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamvibe/poller",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {