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