mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 21:07:27 +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 () {
|
register () {
|
||||||
this.app.singleton('Jax', () => {
|
this.app.singleton('Jax', () => {
|
||||||
const Env = use('Env')
|
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')
|
const DDragonChampionEndpoint = require('./Endpoints/DDragonEndpoints/DDragonChampionEndpoint')
|
||||||
|
|
||||||
class Jax {
|
class Jax {
|
||||||
constructor(key, region = 'euw1') {
|
constructor(key, env) {
|
||||||
this.key = key
|
this.key = key
|
||||||
const limiterOptions = {
|
const limiterOptions = {
|
||||||
strategy: STRATEGY.BURST
|
strategy: env === 'production' ? STRATEGY.SPREAD : STRATEGY.BURST
|
||||||
}
|
}
|
||||||
this.limiter = new RiotRateLimiter(limiterOptions)
|
this.limiter = new RiotRateLimiter(limiterOptions)
|
||||||
this.region = region
|
this.region = 'euw1'
|
||||||
|
|
||||||
this.League = new LeagueEndpoint(this.limiter, this.region)
|
this.League = new LeagueEndpoint(this.limiter, this.region)
|
||||||
this.Match = new MatchEndpoint(this.limiter, this.region)
|
this.Match = new MatchEndpoint(this.limiter, this.region)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue