Fixes error reporting in logging.
This commit is contained in:
@@ -207,8 +207,8 @@ export function watchDymamicConfig() {
|
|||||||
try {
|
try {
|
||||||
const dynamicConfig = yml.load(await readFile(__filepath, 'utf8'));
|
const dynamicConfig = yml.load(await readFile(__filepath, 'utf8'));
|
||||||
buildServerAndClientConfig(dynamicConfig as SPOJO);
|
buildServerAndClientConfig(dynamicConfig as SPOJO);
|
||||||
} catch (error) {
|
} catch (err) {
|
||||||
logger.error({ error }, 'could not read or parse config');
|
logger.error({ err }, 'could not read or parse config');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -221,8 +221,8 @@ export function watchDymamicConfig() {
|
|||||||
for await (const event of watcher) {
|
for await (const event of watcher) {
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (err) {
|
||||||
logger.error({ error }, 'could not watch config');
|
logger.error({ err }, 'could not watch config');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { readable } from 'svelte/store';
|
|||||||
import { serverConfig } from './config';
|
import { serverConfig } from './config';
|
||||||
import { rootLogger } from './logger';
|
import { rootLogger } from './logger';
|
||||||
import type { Unsubscriber } from 'svelte/motion';
|
import type { Unsubscriber } from 'svelte/motion';
|
||||||
|
import { dev } from '$app/environment';
|
||||||
|
|
||||||
const logger = rootLogger.child({ name: 'ServiceData' });
|
const logger = rootLogger.child({ name: 'ServiceData' });
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ export function resetServiceData() {
|
|||||||
|
|
||||||
let pushServiceData: ((value: ServiceDataEvent) => void) | undefined = undefined;
|
let pushServiceData: ((value: ServiceDataEvent) => void) | undefined = undefined;
|
||||||
|
|
||||||
const pollInterval = 30000;
|
const pollInterval = dev ? 2000 : 60000;
|
||||||
|
|
||||||
let serviceData: Array<Array<Partial<ServiceData>>> = [];
|
let serviceData: Array<Array<Partial<ServiceData>>> = [];
|
||||||
|
|
||||||
@@ -77,8 +78,8 @@ function pollAllServices() {
|
|||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((err) => {
|
||||||
serviceLogger.warn({ error }, 'could not poll service');
|
serviceLogger.warn({ err }, 'could not poll service');
|
||||||
return { status: 'offline' };
|
return { status: 'offline' };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export const GET: RequestHandler = ({ getClientAddress }) => {
|
|||||||
let unsubscribe: Unsubscriber | undefined = undefined;
|
let unsubscribe: Unsubscriber | undefined = undefined;
|
||||||
const stream = new ReadableStream({
|
const stream = new ReadableStream({
|
||||||
start: (controller) => {
|
start: (controller) => {
|
||||||
logger.info('new update request stream started');
|
logger.debug('new update request stream started');
|
||||||
|
|
||||||
unsubscribe = subscribeToDataEvent((event) => {
|
unsubscribe = subscribeToDataEvent((event) => {
|
||||||
logger.trace({ event: event }, 'sending new event');
|
logger.trace({ event: event }, 'sending new event');
|
||||||
@@ -24,7 +24,7 @@ export const GET: RequestHandler = ({ getClientAddress }) => {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
cancel: (reason) => {
|
cancel: (reason) => {
|
||||||
logger.info({ reason }, 'stopping request stream');
|
logger.debug({ reason }, 'stopping request stream');
|
||||||
if (unsubscribe != undefined) {
|
if (unsubscribe != undefined) {
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user