File tree 3 files changed +12
-6
lines changed
packages/composites/glv-token
3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,11 @@ export const config = new AdapterConfig(
60
60
required : true ,
61
61
default : 'https://arbitrum-api.gmxinfra.io/tokens' ,
62
62
} ,
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
+ } ,
63
68
BACKGROUND_EXECUTE_MS : {
64
69
description :
65
70
'The amount of time the background execute should sleep before performing the next request' ,
Original file line number Diff line number Diff line change @@ -42,9 +42,7 @@ export class GlvTokenTransport extends SubscriptionTransport<GlvTokenTransportTy
42
42
responseCache ! : ResponseCache < GlvTokenTransportTypes >
43
43
requester ! : Requester
44
44
provider ! : ethers . providers . JsonRpcProvider
45
- readerContract ! : ethers . Contract
46
45
glvReaderContract ! : ethers . Contract
47
- abiEncoder ! : utils . AbiCoder
48
46
settings ! : GlvTokenTransportTypes [ 'Settings' ]
49
47
50
48
tokensMap : Record < string , Token > = { }
@@ -74,10 +72,12 @@ export class GlvTokenTransport extends SubscriptionTransport<GlvTokenTransportTy
74
72
await this . tokenInfo ( )
75
73
await this . marketInfo ( )
76
74
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
+ }
81
81
}
82
82
83
83
async tokenInfo ( ) {
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ describe('execute', () => {
82
82
process . env . ARBITRUM_RPC_URL = process . env . ARBITRUM_RPC_URL ?? 'http://localhost:3040'
83
83
process . env . RETRY = process . env . RETRY ?? '0'
84
84
process . env . BACKGROUND_EXECUTE_MS = '0'
85
+ process . env . METADATA_REFRESH_INTERVAL_MS = '0'
85
86
86
87
const mockDate = new Date ( '2001-01-01T11:11:11.111Z' )
87
88
spy = jest . spyOn ( Date , 'now' ) . mockReturnValue ( mockDate . getTime ( ) )
You can’t perform that action at this time.
0 commit comments