Further improvements to bot caching
This commit is contained in:
parent
4d167568fb
commit
0991572eff
@ -329,15 +329,17 @@ export class BotController
|
|||||||
// Get number of bots we have in cache
|
// Get number of bots we have in cache
|
||||||
const botCacheCount = this.botGenerationCacheService.getCachedBotCount(cacheKey);
|
const botCacheCount = this.botGenerationCacheService.getCachedBotCount(cacheKey);
|
||||||
const botPromises: Promise<void>[] = [];
|
const botPromises: Promise<void>[] = [];
|
||||||
if (botCacheCount < botGenerationDetails.botCountToGenerate)
|
if (botCacheCount > botGenerationDetails.botCountToGenerate)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// We're below desired count, add bots to cache
|
// We're below desired count, add bots to cache
|
||||||
for (let i = 0; i < botGenerationDetails.botCountToGenerate; i++)
|
for (let i = 0; i < botGenerationDetails.botCountToGenerate; i++)
|
||||||
{
|
{
|
||||||
const detailsClone = this.cloner.clone(botGenerationDetails);
|
const detailsClone = this.cloner.clone(botGenerationDetails);
|
||||||
botPromises.push(this.generateSingleBotAndStoreInCache(detailsClone, sessionId, cacheKey));
|
botPromises.push(this.generateSingleBotAndStoreInCache(detailsClone, sessionId, cacheKey));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.all(botPromises).then(() =>
|
return Promise.all(botPromises).then(() =>
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user