new(all): Custom Domain support per bot.

This commit is contained in:
rodrigorodriguez 2022-10-09 23:41:37 -03:00
parent 6a7c2eb0f5
commit 73f20825e7
2 changed files with 14 additions and 13 deletions

View file

@ -106,14 +106,16 @@ export class ScheduleServices extends GBService {
/**
* Load all cached schedule from BASIC SET SCHEDULE keyword.
*/
public async loadSchedules(min: GBMinInstance) {
public async scheduleAll() {
let schedules;
try {
const options = <FindOptions>{ where: { instanceId: min.instance.instanceId } };
schedules = await GuaribasSchedule.findAll(options);
GBLog.verbose(`Loading schedules for ${min.instance.botId}...`);
schedules = await GuaribasSchedule.findAll();
await CollectionUtil.asyncForEach(schedules, async item => {
let min: GBMinInstance = GBServer.globals.minInstances.filter(
p => p.instance.instanceId === item.instanceId
)[0];
this.ScheduleItem(item, min);
});
} catch (error) {
@ -122,7 +124,6 @@ export class ScheduleServices extends GBService {
return schedules;
}
private ScheduleItem(item: GuaribasSchedule, min: GBMinInstance) {
GBLog.info(`\nScheduling ${item.name} on ${min.botId}...`);
try {

View file

@ -175,11 +175,11 @@ export class GBMinService {
format: '[{bar}] Loading {botId} ({value}/{total})...', barsize:60
}, cliProgress.Presets.rect);
let i = 0;
bar1.start(100, i, {botId: "Boot"});
bar1.start(instances.length, i, {botId: "Boot"});
await CollectionUtil.asyncForEach(instances, async instance => {
try {
bar1.update(i, {botId: instance.botId, value:i, total:instances.length});
bar1.update(i, {botId: instance.botId});
await this.mountBot(instance);
GBDeployer.mountGBKBAssets(`${instance.botId}.gbkb`,
@ -191,8 +191,13 @@ export class GBMinService {
});
bar1.stop();
// Loads schedules.
GBLog.info(`Scheduling SET SCHEDULE .gbdialog items...`);
GBLog.info(`Package deployment done.`);
const service = new ScheduleServices();
await service.scheduleAll();
GBLog.info(`Bot minimal instances loaded.`);
}
@ -268,11 +273,6 @@ export class GBMinService {
await KBService.RefreshNER(min);
// Loads schedules.
const service = new ScheduleServices();
await service.loadSchedules(min);
// Calls the loadBot context.activity for all packages.
await this.invokeLoadBot(GBServer.globals.appPackages, GBServer.globals.sysPackages, min);