introduce a new instance api rate limiter
This commit is contained in:
@@ -689,7 +689,7 @@ const eventController = {
|
||||
...pagination,
|
||||
replacements
|
||||
}).catch(e => {
|
||||
log.error('[EVENT]', e)
|
||||
log.error('[EVENT]' + String(e))
|
||||
return []
|
||||
})
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const rateLimit = require('express-rate-limit');
|
||||
const log = require('../../log')
|
||||
const nominatim = require('../../services/geocoding/nominatim')
|
||||
const photon = require('../../services/geocoding/photon')
|
||||
@@ -8,15 +7,6 @@ let d = 0 // departure time
|
||||
let h = 0 // hit geocoding provider time (aka Latency)
|
||||
|
||||
const geocodingController = {
|
||||
/**
|
||||
* TODO: replace/merge with a general 'instance rate-limiter' or 'instance api-related rate-limiter' when this will be defined
|
||||
*/
|
||||
instanceApiRateLimiter: rateLimit({
|
||||
windowMs: 15 * 60 * 1000, // 15 minutes
|
||||
max: 100, // Limit each IP to 100 requests per `window` (here, per 15 minutes)
|
||||
standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers
|
||||
legacyHeaders: false, // Disable the `X-RateLimit-*` headers
|
||||
}),
|
||||
|
||||
/**
|
||||
* Limit provider api usage.
|
||||
|
||||
@@ -3,8 +3,6 @@ const { Place, Event } = require('../models/models')
|
||||
const eventController = require('./event')
|
||||
const exportController = require('./export')
|
||||
|
||||
const { version } = require('../../../package.json')
|
||||
|
||||
const log = require('../../log')
|
||||
const { Op, where, col, fn, cast } = require('sequelize')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user