Guards against empty cache arrays
Prevents errors when attempting to process an empty cache. Deletes the cache entry if it is empty to avoid repeatedly attempting to process an invalid cache entry.
This commit is contained in:
1 file changed
+6
@@ -118,6 +118,12 @@ export class PromptGeneratorService {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Guard against empty cache arrays
|
||||
if (cached.length === 0) {
|
||||
this.cache.delete(cacheKey);
|
||||
return null;
|
||||
}
|
||||
|
||||
const now = new Date().getTime();
|
||||
const cacheTime = cached[0].timestamp.getTime();
|
||||
|
||||
|
||||
Reference in new issue
Block a user