Android: Disable in-memory cache of parsed cards

This commit is contained in:
Cohee
2024-11-24 18:52:47 +02:00
parent b1300d403c
commit b4be50d26a

View File

@ -24,6 +24,8 @@ const defaultAvatarPath = './public/img/ai4.png';
// KV-store for parsed character data
const characterDataCache = new Map();
// Some Android devices require tighter memory management
const isAndroid = process.platform === 'android';
/**
* Reads the character card from the specified image file.
@ -39,7 +41,7 @@ async function readCharacterData(inputFile, inputFormat = 'png') {
}
const result = parse(inputFile, inputFormat);
characterDataCache.set(cacheKey, result);
!isAndroid && characterDataCache.set(cacheKey, result);
return result;
}