From 7b312bb672d777c67d741ca55abd88eb4a2ce3cf Mon Sep 17 00:00:00 2001 From: Sylvain Perron Date: Mon, 25 Mar 2019 15:16:04 -0400 Subject: [PATCH] fix(core): loading of deleted bots warn --- src/bp/core/botpress.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/bp/core/botpress.ts b/src/bp/core/botpress.ts index 9ad2ce1e078..9566099a1eb 100644 --- a/src/bp/core/botpress.ts +++ b/src/bp/core/botpress.ts @@ -184,6 +184,7 @@ export class Botpress { const botsRef = await this.workspaceService.getBotRefs() const botsIds = await this.botService.getBotsIds() const unlinked = _.difference(botsIds, botsRef) + const deleted = _.difference(botsRef, botsIds) if (unlinked.length) { this.logger.warn( @@ -191,9 +192,16 @@ export class Botpress { ) } + if (deleted.length) { + this.logger.warn( + `Some bots have been deleted from the disk but are still referenced in your workspaces.json file. + Please delete them from workspaces.json to get rid of this warning. [${deleted.join(', ')}]` + ) + } + const bots = await this.botService.getBots() const disabledBots = [...bots.values()].filter(b => b.disabled).map(b => b.id) - const botsToMount = _.without(botsRef, ...disabledBots) + const botsToMount = _.without(botsRef, ...disabledBots, ...deleted) await Promise.map(botsToMount, botId => this.botService.mountBot(botId)) }