From 4d76dd83adcf5594780fd7e76f92cd8f6b11c2fd Mon Sep 17 00:00:00 2001 From: k4rli Date: Mon, 11 Aug 2025 14:05:54 +0300 Subject: [PATCH 1/3] feat(MED-105): disable scheduler --- instrumentation.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/instrumentation.ts b/instrumentation.ts index c69cd21..e0b25ac 100644 --- a/instrumentation.ts +++ b/instrumentation.ts @@ -2,6 +2,8 @@ import { type Instrumentation } from 'next'; const isEnabledInDev = process.env.ENABLE_LOCAL_JOBS === 'true'; +const isEnabledScheduler = false as boolean; + export async function register() { const { registerMonitoringInstrumentation } = await import( '@kit/monitoring/instrumentation' @@ -12,7 +14,9 @@ export async function register() { await registerMonitoringInstrumentation(); // Register lightweight in-process job scheduler - await registerJobScheduler(); + if (isEnabledScheduler) { + await registerJobScheduler(); + } } /** @@ -22,12 +26,12 @@ export async function register() { * @param err */ export const onRequestError: Instrumentation.onRequestError = async (err) => { - const { getServerMonitoringService } = await import('@kit/monitoring/server'); + // const { getServerMonitoringService } = await import('@kit/monitoring/server'); - const service = await getServerMonitoringService(); + // const service = await getServerMonitoringService(); - await service.ready(); - await service.captureException(err as Error); + // await service.ready(); + // await service.captureException(err as Error); }; async function registerJobScheduler() { From 91e09878314d6e0b444ab9a72697a7c93d5d0b57 Mon Sep 17 00:00:00 2001 From: k4rli Date: Mon, 11 Aug 2025 14:06:05 +0300 Subject: [PATCH 2/3] feat(MED-105): tooltip content too wide --- components/ui/button-tooltip.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/ui/button-tooltip.tsx b/components/ui/button-tooltip.tsx index 21d1503..935a23c 100644 --- a/components/ui/button-tooltip.tsx +++ b/components/ui/button-tooltip.tsx @@ -24,7 +24,7 @@ export function ButtonTooltip({ - {content} + {content} ); From 7094523d7e2527e3c916c506defb0b1eeffd369e Mon Sep 17 00:00:00 2001 From: k4rli Date: Tue, 12 Aug 2025 12:11:51 +0300 Subject: [PATCH 3/3] feat(MED-105): reset instrumentation.ts --- instrumentation.ts | 69 ++++++---------------------------------------- 1 file changed, 8 insertions(+), 61 deletions(-) diff --git a/instrumentation.ts b/instrumentation.ts index e0b25ac..7fb6d8f 100644 --- a/instrumentation.ts +++ b/instrumentation.ts @@ -1,9 +1,9 @@ +/** + * This file is used to register monitoring instrumentation + * for your Next.js application. + */ import { type Instrumentation } from 'next'; -const isEnabledInDev = process.env.ENABLE_LOCAL_JOBS === 'true'; - -const isEnabledScheduler = false as boolean; - export async function register() { const { registerMonitoringInstrumentation } = await import( '@kit/monitoring/instrumentation' @@ -12,11 +12,6 @@ export async function register() { // Register monitoring instrumentation // based on the MONITORING_PROVIDER environment variable. await registerMonitoringInstrumentation(); - - // Register lightweight in-process job scheduler - if (isEnabledScheduler) { - await registerJobScheduler(); - } } /** @@ -26,58 +21,10 @@ export async function register() { * @param err */ export const onRequestError: Instrumentation.onRequestError = async (err) => { - // const { getServerMonitoringService } = await import('@kit/monitoring/server'); + const { getServerMonitoringService } = await import('@kit/monitoring/server'); - // const service = await getServerMonitoringService(); + const service = await getServerMonitoringService(); - // await service.ready(); - // await service.captureException(err as Error); + await service.ready(); + await service.captureException(err as Error); }; - -async function registerJobScheduler() { - const isProd = process.env.NODE_ENV === 'production'; - if (!isProd && !isEnabledInDev) { - console.info('Job scheduler disabled'); - return; - } - - // Prevent duplicate intervals on hot reloads/dev - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const globalAny = globalThis as any; - if (globalAny.__mrJobSchedulerInitialized) { - console.info('Job scheduler already initialized'); - return; - } - globalAny.__mrJobSchedulerInitialized = true; - - let isRunning = false; - - const runSyncAnalysisResults = async () => { - if (isRunning) { - console.info('Scheduled job syncAnalysisResults skipped: previous run still in progress'); - return; - } - isRunning = true; - try { - try { - const { default: loadEnv } = await import('./app/api/job/handler/load-env'); - loadEnv(); - } catch { - // ignore if not available or already loaded - } - - const { default: syncAnalysisResults } = await import( - './app/api/job/handler/sync-analysis-results' - ); - await syncAnalysisResults(); - } catch (error) { - console.error('Scheduled job syncAnalysisResults failed:', error); - } finally { - isRunning = false; - } - }; - - // Run every 10 minutes - setTimeout(runSyncAnalysisResults, 15_000); - setInterval(runSyncAnalysisResults, 10 * 60 * 1000); -}