File tree Expand file tree Collapse file tree 4 files changed +12
-11
lines changed
packages/sources/nav-consulting/src Expand file tree Collapse file tree 4 files changed +12
-11
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @chainlink/nav-consulting-adapter ' : patch
3
+ ---
4
+
5
+ Reduce rate limiter
Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ export const config = new AdapterConfig(
12
12
description :
13
13
'The amount of time the background execute should sleep before performing the next request' ,
14
14
type : 'number' ,
15
- default : 10_000 ,
15
+ default : 60_000 , // one call per minute
16
16
} ,
17
17
} ,
18
18
{
19
19
envDefaultOverrides : {
20
- CACHE_MAX_AGE : 300_000 , // Due to API limit of 2 request per minute
20
+ CACHE_MAX_AGE : 600_000 , // 10 minute cache
21
21
} ,
22
22
} ,
23
23
)
Original file line number Diff line number Diff line change @@ -8,14 +8,6 @@ export const adapter = new Adapter({
8
8
name : 'NAV_CONSULTING' ,
9
9
config,
10
10
endpoints : [ reserve ] ,
11
- rateLimiting : {
12
- tiers : {
13
- default : {
14
- rateLimit1m : 4 ,
15
- note : '60/min in total shared by 30 EA instance, each EA can do 2 per min per API. Each call hits 2 API' ,
16
- } ,
17
- } ,
18
- } ,
19
11
} )
20
12
21
13
export const server = ( ) : Promise < ServerInstance | undefined > => expose ( adapter )
Original file line number Diff line number Diff line change @@ -34,7 +34,11 @@ export class NavConsultingTransport extends SubscriptionTransport<BaseEndpointTy
34
34
}
35
35
async backgroundHandler ( context : EndpointContext < BaseEndpointTypes > , entries : RequestParams [ ] ) {
36
36
await Promise . all ( entries . map ( async ( param ) => this . handleRequest ( param ) ) )
37
- await sleep ( context . adapterSettings . BACKGROUND_EXECUTE_MS )
37
+ if ( entries . length == 0 ) {
38
+ await sleep ( 1_000 )
39
+ } else {
40
+ await sleep ( context . adapterSettings . BACKGROUND_EXECUTE_MS )
41
+ }
38
42
}
39
43
40
44
async handleRequest ( param : RequestParams ) {
You can’t perform that action at this time.
0 commit comments