taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit d5fef14ac8c741654e815a046e3de1c4b86ea767
parent a001795148d9c535160cb98380b3e752ab2f7998
Author: Sebastian <sebasjm@gmail.com>
Date:   Wed, 23 Apr 2025 13:56:46 -0300

prevent dashboard for hitting throttle limit

Diffstat:
Mpackages/aml-backoffice-ui/src/hooks/server-info.ts | 2+-
Mpackages/web-util/src/context/exchange-api.ts | 15++++++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/packages/aml-backoffice-ui/src/hooks/server-info.ts b/packages/aml-backoffice-ui/src/hooks/server-info.ts @@ -81,7 +81,7 @@ export function useServerStatistics( const session = officer.state === "ready" ? officer.account : undefined; const { - lib: { exchange: api }, + unthrottledApi: { exchange: api }, } = useExchangeApiContext(); const keys = diff --git a/packages/web-util/src/context/exchange-api.ts b/packages/web-util/src/context/exchange-api.ts @@ -53,6 +53,15 @@ export type ExchangeContextType = { url: URL; config: KeysAndConfigType; lib: ExchangeLib; + /** + * Do not use. This is here because the AML dashboard does too many + * request to the event API + * + * FIXME: The server should expose a better API + * https://bugs.gnunet.org/view.php?id=9776 + * @deprecated + */ + unthrottledApi: ExchangeLib; hints: VersionHint[]; onActivity: Subscriber<ObservabilityEvent>; cancelRequest: (eventId: string) => void; @@ -162,11 +171,14 @@ export const ExchangeApiProvider = ({ }); } + const {lib: unthrottledApi} = buildExchangeApiClient(baseUrl, evictors, !!preventCompression, true) + const value: ExchangeContextType = { url: baseUrl, config: checked.config, onActivity: onActivity, lib, + unthrottledApi, cancelRequest, hints: checked.hints, }; @@ -180,9 +192,10 @@ function buildExchangeApiClient( url: URL, evictors: Evictors, preventCompression: boolean, + disableThrottling?: boolean, ): APIClient<ExchangeLib, KeysAndConfigType> { const httpFetch = new BrowserFetchHttpLib({ - enableThrottling: true, + enableThrottling: !disableThrottling, requireTls: false, }); const tracker = new ActiviyTracker<ObservabilityEvent>();