Fetch multiple unsent messages at once to speed up delivery

This commit is contained in:
Andris Reinman 2016-05-25 18:01:39 +03:00
parent 9a5d723663
commit f29a8a1b67
9 changed files with 184 additions and 77 deletions

28
setup/fakedata.js Normal file
View file

@ -0,0 +1,28 @@
'use strict';
let faker = require('faker');
let accounts = 100 * 1000;
let row = 0;
let getNext = () => {
let firstName = faker.name.firstName(); // Rowan Nikolaus
let lastName = faker.name.lastName(); // Rowan Nikolaus
let email = faker.internet.email(firstName, lastName); // Kassandra.Haley@erich.biz
let subscriber = {
firstName,
lastName,
email,
company: faker.company.companyName(),
phone: faker.phone.phoneNumber()
};
process.stdout.write('\n' + Object.keys(subscriber).map(key => JSON.stringify(subscriber[key])).join(','));
if (++row < accounts) {
setImmediate(getNext);
}
};
process.stdout.write('First name,Last name,E-Mail,Company,Phone number');
getNext();