Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixes #46: Queue timer fires even when api key isn't configured
This will also prevent plugin startup and all timers from running.
  • Loading branch information
niemyjski committed Feb 23, 2023
commit 6be3e09e5e82d1fbe23984af919c072fc501690b
15 changes: 11 additions & 4 deletions packages/core/src/ExceptionlessClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export class ExceptionlessClient {
await SettingsManager.applySavedServerSettings(this.config);
}

if (!this.config.isValid) {
this.config.services.log.warn("Exceptionless is not configured and will not process events.");
return;
}

this.updateSettingsTimer(!!configurationOrApiKey);
await EventPluginManager.startup(new PluginContext(this));

Expand Down Expand Up @@ -63,19 +68,21 @@ export class ExceptionlessClient {
await this.config.services.queue.process();
}

private updateSettingsTimer(startingUp = false) {
private updateSettingsTimer(startingUp: boolean = false) {
this.suspendSettingsTimer();

if (!this.config.isValid) {
return;
}

const interval = this.config.updateSettingsWhenIdleInterval;
if (interval > 0) {
let initialDelay: number = interval;
if (startingUp) {
initialDelay = this.config.settingsVersion > 0 ? 15000 : 5000;
}

this.config.services.log.info(
`Update settings every ${interval}ms (${initialDelay || 0}ms delay)`,
);
this.config.services.log.info(`Update settings every ${interval}ms (${initialDelay || 0}ms delay)`);
// TODO: Look into better async scheduling..
const updateSettings = () =>
void SettingsManager.updateSettings(this.config);
Expand Down