Skip to content

Commit

Permalink
fix(core): loading of deleted bots warn
Browse files Browse the repository at this point in the history
  • Loading branch information
slvnperron committed Mar 25, 2019
1 parent 74b7ed2 commit 7b312bb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/bp/core/botpress.ts
Expand Up @@ -184,16 +184,24 @@ 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(
`Some unlinked bots exist on your server, to enable them add them to workspaces.json [${unlinked.join(', ')}]`
)
}

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))
}
Expand Down

0 comments on commit 7b312bb

Please sign in to comment.