Skip to content

Commit d63dc40

Browse files
authored
Include rate limit for new adapters with http transport (#649)
* Include rate limit for new adapters with http transport * Expand comment
1 parent d5d71c0 commit d63dc40

File tree

1 file changed

+15
-0
lines changed
  • scripts/generator-adapter/generators/app/templates/src

1 file changed

+15
-0
lines changed

scripts/generator-adapter/generators/app/templates/src/index.ts.ejs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@ export const adapter = new Adapter({
1616
<% if (includeComments) { -%>
1717
// List of supported endpoints
1818
<% } -%><%= ' ' %> endpoints: [<%= endpointNames %>],
19+
<% if (Object.values(endpoints).some(endpoint => endpoint.inputTransports.some(({ type }) => type === 'http'))) { -%>
20+
<% if (includeComments) { -%>
21+
// Rate limit otherwise we send requests as fast as possible without delay.
22+
// You should adjust this based on what the data provider can tolerate and
23+
// how fresh you need your data to be. The rate limit is global for all
24+
// requests going through transport.dependencies.requester, which includes
25+
// the requests prepared in HttpTransport.prepareRequests.
26+
<% } -%><%= ' ' %> rateLimiting: {
27+
tiers: {
28+
default: {
29+
rateLimit1m: 6,
30+
},
31+
},
32+
},
33+
<% } -%>
1934
})
2035

2136
export const server = (): Promise<ServerInstance | undefined> => expose(adapter)

0 commit comments

Comments
 (0)