Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellacosse committed Dec 20, 2024
1 parent 67bec27 commit 40faae7
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions server_manager/www/shadowbox_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,6 @@ export class ShadowboxServer implements server.Server {
this.supportedEndpoints = {
'experimental/server/metrics': false,
};

this.api
.request<server.ServerMetricsJson>('experimental/server/metrics')
.then(
() => (this.supportedEndpoints['experimental/server/metrics'] = true)
)
.catch(error => {
// endpoint is not defined, keep set to false
if (error.response.status === 404) return;

this.supportedEndpoints['experimental/server/metrics'] = true;
});
}

getId(): string {
Expand Down Expand Up @@ -173,7 +161,7 @@ export class ShadowboxServer implements server.Server {
async getServerMetrics(): Promise<server.ServerMetricsJson> {
if (this.supportedEndpoints['experimental/server/metrics']) {
return this.api.request<server.ServerMetricsJson>(
'experimental/server/metrics'
'experimental/server/metrics?since=30d'
);
}

Expand Down Expand Up @@ -298,6 +286,20 @@ export class ShadowboxServer implements server.Server {

protected setManagementApi(api: PathApiClient): void {
this.api = api;

this.api
.request<server.ServerMetricsJson>(
'experimental/server/metrics?since=30d'
)
.then(
() => (this.supportedEndpoints['experimental/server/metrics'] = true)
)
.catch(error => {
// endpoint is not defined, keep set to false
if (error.response.status === 404) return;

this.supportedEndpoints['experimental/server/metrics'] = true;
});
}

getManagementApiUrl(): string {
Expand Down

0 comments on commit 40faae7

Please sign in to comment.