Make trim cache not cancellable

This commit is contained in:
Robert 2024-03-28 10:58:42 +00:00
Родитель e23d4a9d9f
Коммит 28bf345ea8
2 изменённых файлов: 3 добавлений и 8 удалений

Просмотреть файл

@ -678,20 +678,18 @@ export class DatabaseUI extends DisposableObject {
private async handleTrimCache(): Promise<void> { private async handleTrimCache(): Promise<void> {
return withProgress( return withProgress(
async (_progress, token) => { async () => {
if ( if (
this.queryServer !== undefined && this.queryServer !== undefined &&
this.databaseManager.currentDatabaseItem !== undefined this.databaseManager.currentDatabaseItem !== undefined
) { ) {
await this.queryServer.trimCacheInDatabase( await this.queryServer.trimCacheInDatabase(
this.databaseManager.currentDatabaseItem, this.databaseManager.currentDatabaseItem,
token,
); );
} }
}, },
{ {
title: "Trimming cache", title: "Trimming cache",
cancellable: true,
}, },
); );
} }

Просмотреть файл

@ -112,10 +112,7 @@ export class QueryRunner {
await this.qs.sendRequest(clearCache, params); await this.qs.sendRequest(clearCache, params);
} }
async trimCacheInDatabase( async trimCacheInDatabase(dbItem: DatabaseItem): Promise<void> {
dbItem: DatabaseItem,
token: CancellationToken,
): Promise<void> {
if (dbItem.contents === undefined) { if (dbItem.contents === undefined) {
throw new Error("Can't trim the cache in an invalid database."); throw new Error("Can't trim the cache in an invalid database.");
} }
@ -124,7 +121,7 @@ export class QueryRunner {
const params: TrimCacheParams = { const params: TrimCacheParams = {
db, db,
}; };
await this.qs.sendRequest(trimCache, params, token); await this.qs.sendRequest(trimCache, params);
} }
public async compileAndRunQueryAgainstDatabaseCore( public async compileAndRunQueryAgainstDatabaseCore(