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

View file

@ -175,11 +175,11 @@ export class GBMinService {
format: '[{bar}] Loading {botId} ({value}/{total})...', barsize:60 format: '[{bar}] Loading {botId} ({value}/{total})...', barsize:60
}, cliProgress.Presets.rect); }, cliProgress.Presets.rect);
let i = 0; let i = 0;
bar1.start(100, i, {botId: "Boot"}); bar1.start(instances.length, i, {botId: "Boot"});
await CollectionUtil.asyncForEach(instances, async instance => { await CollectionUtil.asyncForEach(instances, async instance => {
try { try {
bar1.update(i, {botId: instance.botId, value:i, total:instances.length}); bar1.update(i, {botId: instance.botId});
await this.mountBot(instance); await this.mountBot(instance);
GBDeployer.mountGBKBAssets(`${instance.botId}.gbkb`, GBDeployer.mountGBKBAssets(`${instance.botId}.gbkb`,
@ -191,8 +191,13 @@ export class GBMinService {
}); });
bar1.stop(); 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); await KBService.RefreshNER(min);
// Loads schedules.
const service = new ScheduleServices();
await service.loadSchedules(min);
// Calls the loadBot context.activity for all packages. // Calls the loadBot context.activity for all packages.
await this.invokeLoadBot(GBServer.globals.appPackages, GBServer.globals.sysPackages, min); await this.invokeLoadBot(GBServer.globals.appPackages, GBServer.globals.sysPackages, min);