mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
add 1 second timeout to geoiplookup
response times generally seem to be around 0.05s from our servers
This commit is contained in:
parent
2e6c2c1926
commit
3ca04e25fd
2 changed files with 3 additions and 2 deletions
|
@ -25,6 +25,7 @@ module.exports = GeoIpLookup =
|
||||||
|
|
||||||
opts =
|
opts =
|
||||||
url: "#{settings.apis.geoIpLookup.url}/#{ip}"
|
url: "#{settings.apis.geoIpLookup.url}/#{ip}"
|
||||||
|
timeout: 1000
|
||||||
request.get opts, (err, ipDetails)->
|
request.get opts, (err, ipDetails)->
|
||||||
callback(err, ipDetails)
|
callback(err, ipDetails)
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ describe "GeoIpLookup", ->
|
||||||
|
|
||||||
it "should request the details using the ip", (done)->
|
it "should request the details using the ip", (done)->
|
||||||
@GeoIpLookup.getDetails @ipAddress, (err)=>
|
@GeoIpLookup.getDetails @ipAddress, (err)=>
|
||||||
@request.get.calledWith(url:@settings.apis.geoIpLookup.url+"/"+@ipAddress).should.equal true
|
@request.get.calledWith({url:@settings.apis.geoIpLookup.url+"/"+@ipAddress, timeout:1000}).should.equal true
|
||||||
done()
|
done()
|
||||||
|
|
||||||
it "should return the ip details", (done)->
|
it "should return the ip details", (done)->
|
||||||
|
@ -51,7 +51,7 @@ describe "GeoIpLookup", ->
|
||||||
|
|
||||||
it "should take the first ip in the string", (done)->
|
it "should take the first ip in the string", (done)->
|
||||||
@GeoIpLookup.getDetails " #{@ipAddress} 456.312.452.102 432.433.888.234", (err)=>
|
@GeoIpLookup.getDetails " #{@ipAddress} 456.312.452.102 432.433.888.234", (err)=>
|
||||||
@request.get.calledWith(url:@settings.apis.geoIpLookup.url+"/"+@ipAddress).should.equal true
|
@request.get.calledWith({url:@settings.apis.geoIpLookup.url+"/"+@ipAddress, timeout:1000}).should.equal true
|
||||||
done()
|
done()
|
||||||
|
|
||||||
describe "getCurrencyCode", ->
|
describe "getCurrencyCode", ->
|
||||||
|
|
Loading…
Reference in a new issue