@finos/legend-application-marketplace
Version:
Legend Marketplace application core
46 lines • 1.98 kB
TypeScript
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import type { PlainObject } from '@finos/legend-shared';
import type { V1_PendingTasksResponse } from '@finos/legend-graph';
import type { LakehouseContractServerClient } from '@finos/legend-server-lakehouse';
/**
* Default TTL for cached pending-tasks responses. The entitlements server
* was reporting overload from this endpoint, so we cache responses briefly
* and dedupe in-flight requests across all UI consumers (header badge,
* entitlements dashboard, etc.).
*/
export declare const PENDING_TASKS_CACHE_TTL_MS = 60000;
/**
* Shared cache + in-flight request dedupe for `getPendingTasks`.
*
* - Multiple concurrent callers for the same user share a single network call.
* - Subsequent callers within `PENDING_TASKS_CACHE_TTL_MS` get the cached
* response without hitting the server.
* - Mutating operations (approve/deny) should call `invalidate()` so the
* next read refreshes.
*/
export declare class PendingTasksCache {
private readonly client;
private readonly cache;
private readonly inFlight;
constructor(client: LakehouseContractServerClient);
private static keyFor;
invalidate(user?: string): void;
fetch(user: string | undefined, token: string | undefined, options?: {
forceRefresh?: boolean;
}): Promise<PlainObject<V1_PendingTasksResponse>>;
}
//# sourceMappingURL=PendingTasksCache.d.ts.map