Skip to content

Is it really async? #19

@msukhotin

Description

@msukhotin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions