将请求默认并行从64调整到8,减少对taskpool execute内存消耗

Signed-off-by: madixin <madixin@huawei.com>
This commit is contained in:
madixin 2024-05-05 16:36:23 +08:00
parent 0e2245b5f6
commit 4c0ee994a9
4 changed files with 14 additions and 15 deletions

View File

@ -1,4 +1,7 @@
## 3.0.0-rc.3
- 将请求默认并行从64调整到8减少对taskpool execute内存消耗
## 3.0.0-rc.2
- 新增支持使用一个或多个图片变换,如模糊,高亮等

View File

@ -14,7 +14,7 @@
"main": "index.ets",
"repository": "https://gitee.com/openharmony-tpc/ImageKnife",
"type": "module",
"version": "3.0.0-rc.2",
"version": "3.0.0-rc.3",
"dependencies": {
},

View File

@ -209,10 +209,10 @@ export class FileCache {
break
}
let delkey = this.lruCache.keys()[0]
let data: ArrayBuffer | undefined = FileUtils.getInstance().readFileSync(this.path + delkey)
if (data !== undefined) {
let remove: number | undefined = this.lruCache.remove(delkey)
if (remove !== undefined) {
FileUtils.getInstance().deleteFile(this.path + delkey)
this.removeMemorySize(data)
this.removeMemorySize(remove)
}
this.lruCache.remove(delkey)
}

View File

@ -57,18 +57,14 @@ export class FileUtils {
* @param path
* @returns
*/
async deleteFile(path: string): Promise<boolean> {
const isExist: boolean = await fs.access(path)
if (isExist) {
try {
await fs.unlink(path)
}
catch (err) {
LogUtil.error("FileUtils deleteFile failed: err msg=" + err.message + " err code=" + err.code);
return false
}
async deleteFile(path: string): Promise<void> {
// const isExist: boolean = await fs.access(path)
// if (isExist) {
try {
await fs.unlink(path)
} catch (err) {
LogUtil.error("FileUtils deleteFile failed: err msg=" + err.message + " err code=" + err.code);
}
return true
}
/**