Skip to content

Instantly share code, notes, and snippets.

@luk-
Forked from ada-lovecraft/gist:5365946
Last active December 16, 2015 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luk-/5365959 to your computer and use it in GitHub Desktop.
Save luk-/5365959 to your computer and use it in GitHub Desktop.
var record = {
id: idgen(20) ,
data: {
ip: parts[0],
agent: parts[1],
url: parts[2],
referrer: parts[3],
mobile: mobile
}
};
userRecords.push(record);
...
db.on('ready', function () {
userRecords.forEach(function(record,index,array) {
db.put(record.id,record.data, function(err) {
if(err)
console.log(clc.redBright.bold('Error inserting user record: ') + err);
if (index == array.length-1)
console.timeEnd('user-leveldb-write');
});
});
})
500 records work
500K records does not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment