mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
refactor: change RiotLimiter strategy according to environment
This commit is contained in:
parent
3dfd4d87a6
commit
db939459a0
2 changed files with 4 additions and 4 deletions
|
|
@ -5,7 +5,7 @@ class JaxProvider extends ServiceProvider {
|
|||
register () {
|
||||
this.app.singleton('Jax', () => {
|
||||
const Env = use('Env')
|
||||
return new Jax(Env.get('API_KEY'))
|
||||
return new Jax(Env.get('API_KEY'), Env.get('NODE_ENV'))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ const DDragonVersionEndpoint = require('./Endpoints/DDragonEndpoints/DDragonVers
|
|||
const DDragonChampionEndpoint = require('./Endpoints/DDragonEndpoints/DDragonChampionEndpoint')
|
||||
|
||||
class Jax {
|
||||
constructor(key, region = 'euw1') {
|
||||
constructor(key, env) {
|
||||
this.key = key
|
||||
const limiterOptions = {
|
||||
strategy: STRATEGY.BURST
|
||||
strategy: env === 'production' ? STRATEGY.SPREAD : STRATEGY.BURST
|
||||
}
|
||||
this.limiter = new RiotRateLimiter(limiterOptions)
|
||||
this.region = region
|
||||
this.region = 'euw1'
|
||||
|
||||
this.League = new LeagueEndpoint(this.limiter, this.region)
|
||||
this.Match = new MatchEndpoint(this.limiter, this.region)
|
||||
|
|
|
|||
Loading…
Reference in a new issue