Skip to content

Commit 45e37fa

Browse files
committed
Fixes #46: Queue timer fires even when api key isn't configured
This will also prevent plugin startup and all timers from running.
1 parent f4c0e33 commit 45e37fa

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

packages/core/src/ExceptionlessClient.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ export class ExceptionlessClient {
3232
await SettingsManager.applySavedServerSettings(this.config);
3333
}
3434

35+
if (!this.config.isValid) {
36+
this.config.services.log.warn("Exceptionless is not configured and will not process events.");
37+
return;
38+
}
39+
3540
this.updateSettingsTimer(!!configurationOrApiKey);
3641
await EventPluginManager.startup(new PluginContext(this));
3742

@@ -63,19 +68,21 @@ export class ExceptionlessClient {
6368
await this.config.services.queue.process();
6469
}
6570

66-
private updateSettingsTimer(startingUp = false) {
71+
private updateSettingsTimer(startingUp: boolean = false) {
6772
this.suspendSettingsTimer();
6873

74+
if (!this.config.isValid) {
75+
return;
76+
}
77+
6978
const interval = this.config.updateSettingsWhenIdleInterval;
7079
if (interval > 0) {
7180
let initialDelay: number = interval;
7281
if (startingUp) {
7382
initialDelay = this.config.settingsVersion > 0 ? 15000 : 5000;
7483
}
7584

76-
this.config.services.log.info(
77-
`Update settings every ${interval}ms (${initialDelay || 0}ms delay)`,
78-
);
85+
this.config.services.log.info(`Update settings every ${interval}ms (${initialDelay || 0}ms delay)`);
7986
// TODO: Look into better async scheduling..
8087
const updateSettings = () =>
8188
void SettingsManager.updateSettings(this.config);

0 commit comments

Comments
 (0)