Skip to content

Commit 1f1bf07

Browse files
fix integration test
1 parent 5fc43c8 commit 1f1bf07

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

packages/composites/glv-token/src/config/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ export const config = new AdapterConfig(
6060
required: true,
6161
default: 'https://arbitrum-api.gmxinfra.io/tokens',
6262
},
63+
METADATA_REFRESH_INTERVAL_MS: {
64+
description: 'The amount of time the metadata should be refreshed',
65+
type: 'number',
66+
default: 60 * 60 * 3 * 1000, // 3 hours
67+
},
6368
BACKGROUND_EXECUTE_MS: {
6469
description:
6570
'The amount of time the background execute should sleep before performing the next request',

packages/composites/glv-token/src/transport/price.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ export class GlvTokenTransport extends SubscriptionTransport<GlvTokenTransportTy
4242
responseCache!: ResponseCache<GlvTokenTransportTypes>
4343
requester!: Requester
4444
provider!: ethers.providers.JsonRpcProvider
45-
readerContract!: ethers.Contract
4645
glvReaderContract!: ethers.Contract
47-
abiEncoder!: utils.AbiCoder
4846
settings!: GlvTokenTransportTypes['Settings']
4947

5048
tokensMap: Record<string, Token> = {}
@@ -74,10 +72,12 @@ export class GlvTokenTransport extends SubscriptionTransport<GlvTokenTransportTy
7472
await this.tokenInfo()
7573
await this.marketInfo()
7674

77-
// setInterval(() => {
78-
// this.tokenInfo()
79-
// this.marketInfo()
80-
// }, 60 * 60 * 3 * 1000) // 3 hours
75+
if (this.settings.METADATA_REFRESH_INTERVAL_MS > 0) {
76+
setInterval(() => {
77+
this.tokenInfo()
78+
this.marketInfo()
79+
}, this.settings.METADATA_REFRESH_INTERVAL_MS)
80+
}
8181
}
8282

8383
async tokenInfo() {

packages/composites/glv-token/test/integration/adapter.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ describe('execute', () => {
8282
process.env.ARBITRUM_RPC_URL = process.env.ARBITRUM_RPC_URL ?? 'http://localhost:3040'
8383
process.env.RETRY = process.env.RETRY ?? '0'
8484
process.env.BACKGROUND_EXECUTE_MS = '0'
85+
process.env.METADATA_REFRESH_INTERVAL_MS = '0'
8586

8687
const mockDate = new Date('2001-01-01T11:11:11.111Z')
8788
spy = jest.spyOn(Date, 'now').mockReturnValue(mockDate.getTime())

0 commit comments

Comments
 (0)