Skip to content

Commit

Permalink
add separate timeout for GLV info APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
akuzni2 committed Feb 4, 2025
1 parent 2214fae commit 6b13e75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/composites/glv-token/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ export const config = new AdapterConfig(
required: true,
default: 'https://arbitrum-api.gmxinfra.io/tokens',
},
GLV_INFO_API_TIMEOUT_MS: {
description:
'The amount of time the request to the GLV info APIs should wait before timing out. ' +
'Distinct from timeout used to make requests to the EAs which can be set with API_TIMEOUT',
type: 'number',
default: 10_000,
},
METADATA_REFRESH_INTERVAL_MS: {
description: 'The amount of time the metadata should be refreshed',
type: 'number',
Expand Down
4 changes: 4 additions & 0 deletions packages/composites/glv-token/src/transport/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ export abstract class BaseGlvTransport<
const requestConfig = {
url: this.settings.TOKEN_INFO_API,
method: 'GET',
timeout: this.settings.GLV_INFO_API_TIMEOUT_MS,
}

logger.info('Fetching token info')
const response = await this.requester.request<{ tokens: Token[] }>(
JSON.stringify(requestConfig),
requestConfig,
Expand All @@ -127,8 +129,10 @@ export abstract class BaseGlvTransport<
const requestConfig = {
url: this.settings.MARKET_INFO_API,
method: 'GET',
timeout: this.settings.GLV_INFO_API_TIMEOUT_MS,
}

logger.info('Fetching market info')
const response = await this.requester.request<{ markets: Market[] }>(
JSON.stringify(requestConfig),
requestConfig,
Expand Down

0 comments on commit 6b13e75

Please sign in to comment.