1- ' use strict' ;
1+ " use strict" ;
22
33const argv = require ( 'yargs' ) . argv ;
44const MongoClient = require ( 'mongodb' ) . MongoClient ;
55const spawn = require ( 'child_process' ) . spawn ;
66const parallel = require ( 'async-await-parallel' ) ;
77
8- const hostName = ' mongodb://127.0.0.1:7000' ;
9- const databaseName = ' weather_stations' ;
10- const collectionName = ' daily_readings' ;
8+ const hostName = " mongodb://127.0.0.1:7000" ;
9+ const databaseName = " weather_stations" ;
10+ const collectionName = " daily_readings" ;
1111
1212//
1313// Open the connection to the database.
@@ -31,18 +31,18 @@ function openDatabase () {
3131//
3232function runSlave ( skip , limit , slaveIndex ) {
3333 return new Promise ( ( resolve , reject ) => {
34- const args = [ ' listing-8.js' , ' --skip' , skip , ' --limit' , limit ] ;
34+ const args = [ " listing-8.js" , " --skip" , skip , " --limit" , limit ] ;
3535
36- const childProcess = spawn ( ' node' , args ) ;
37- childProcess . stdout . on ( ' data' , data => {
36+ const childProcess = spawn ( " node" , args ) ;
37+ childProcess . stdout . on ( " data" , data => {
3838 console . log ( "[" + slaveIndex + "]: INF: " + data ) ;
3939 } ) ;
4040
41- childProcess . stderr . on ( ' data' , data => {
41+ childProcess . stderr . on ( " data" , data => {
4242 console . log ( "[" + slaveIndex + "]: ERR: " + data ) ;
4343 } ) ;
4444
45- childProcess . on ( ' close' , code => {
45+ childProcess . on ( " close" , code => {
4646 if ( code === 0 ) {
4747 resolve ( ) ;
4848 }
@@ -51,7 +51,7 @@ function runSlave (skip, limit, slaveIndex) {
5151 }
5252 } ) ;
5353
54- childProcess . on ( ' error' , err => {
54+ childProcess . on ( " error" , err => {
5555 reject ( err ) ;
5656 } ) ;
5757 } ) ;
0 commit comments