diff --git a/lib/agent/providers/geo/strategies.js b/lib/agent/providers/geo/strategies.js index e56eaa431..cc474fc93 100644 --- a/lib/agent/providers/geo/strategies.js +++ b/lib/agent/providers/geo/strategies.js @@ -34,8 +34,8 @@ function geoip(cb) { } var save_data = (data) => { - storage.do('set', {type: 'keys', id: 'geo', data: {value: JSON.stringify(data)}}, (err) => { - if (err) logger.error('Unable to save geo data'); + storage.do('set', {type: 'keys', id: 'last_wifi_location', data: {value: JSON.stringify(data)}}, (err) => { + if (err) logger.error('Unable to save last_wifi_location data'); }); } @@ -80,7 +80,7 @@ function wifi(cb) { needle.post(GEO_ENDPOINT, data, opts, function(err, resp, body) { if (resp.statusCode == 429) { - storage.do('query', {type: 'keys', column: 'id', data: 'geo'}, (err, stored_data) => { + storage.do('query', {type: 'keys', column: 'id', data: 'last_wifi_location'}, (err, stored_data) => { if (err) return cb(new Error('Unable to read geo data')); if (stored_data.length == 0) return cb(new Error('There is no geo data in DB')); else{ @@ -176,12 +176,12 @@ function wifi(cb) { method: 'wifi' }; - storage.do('query', {type: 'keys', column: 'id', data: 'geo'}, (err, stored_data) => { - if (err) logger.error('Unable to read geo data'); + storage.do('query', {type: 'keys', column: 'id', data: 'last_wifi_location'}, (err, stored_data) => { + if (err) logger.error('Unable to read last_wifi_location data'); if (stored_data.length == 0) save_data(data); else{ - storage.do('del', {type: 'keys', id: 'geo'}, (err) => { - if (err) logger.error('Unable to delete geo data'); + storage.do('del', {type: 'keys', id: 'last_wifi_location'}, (err) => { + if (err) logger.error('Unable to delete last_wifi_location data'); save_data(data); }) }