Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ymao1 committed Jan 23, 2023
1 parent 0360c36 commit 9d48b9f
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ export class AlertsService implements IAlertsService {
installFn: () => Promise<void>,
timeoutMs: number = INSTALLATION_TIMEOUT
): Promise<void> {
let serverStopped: boolean = false;
try {
let timeoutId: NodeJS.Timeout;
const install = async (): Promise<void> => {
Expand All @@ -496,8 +497,8 @@ export class AlertsService implements IAlertsService {

firstValueFrom(this.options.pluginStop$).then(() => {
clearTimeout(timeoutId);
const msg = 'Server is stopping; must stop all async operations';
reject(new Error(msg));
serverStopped = true;
reject(new Error('Server is stopping; must stop all async operations'));
});
});
};
Expand All @@ -506,7 +507,7 @@ export class AlertsService implements IAlertsService {
} catch (e) {
this.options.logger.error(e);

if (e?.message.indexOf('Server is stopping') < 0) {
if (!serverStopped) {
const reason = e?.message || 'Unknown reason';
throw new Error(`Failure during installation. ${reason}`);
}
Expand Down

0 comments on commit 9d48b9f

Please sign in to comment.