node-maxmind-db
node-maxmind-db copied to clipboard
Is it really async?
Hi
I'm trying the following code:
var log = require('debug')('app:maxmind'),
mmdbreader = require('maxmind-db-reader');
log('preparing');
var cities = mmdbreader.openSync('./data/GeoIP2-City.mmdb');
log('ready');
for (i=1; i<250; i++) {
cities.getGeoData('5.'+i+'.143.20', function(err,geodata){
if (!err && geodata && geodata.city)
log(geodata.city.geoname_id);
});
}
app:maxmind preparing +0ms
app:maxmind ready +81ms
app:maxmind 677697 +181ms
app:maxmind 680963 +1ms
app:maxmind 287286 +1ms
app:maxmind 745044 +0ms
app:maxmind 745044 +0ms
app:maxmind 295548 +0ms
app:maxmind 294071 +0ms
app:maxmind 292223 +0ms
app:maxmind 287286 +1ms
app:maxmind 3186886 +0ms
etc...
How could I explain why it took 181 ms to find first ip? Also results order is always the same.
https://github.com/runk/node-maxmind