Sha256: 18304e09f8f1e3f89d4e842841bfc45b46e6ecd21bb5b3733c69cf7a1a154a80

Contents?: true

Size: 897 Bytes

Versions: 62

Compression:

Stored size: 897 Bytes

Contents

'use strict';
var request = require('request');
var async = require('async');
var assign = require('object-assign');
var Insight = require('./');

// Messaged on each debounced track()
// Gets the queue, merges is with the previous and tries to upload everything
// If it fails, it will save everything again
process.on('message', function (msg) {
	var insight = new Insight(msg);
	var config = insight.config;
	var q = config.get('queue') || {};

	assign(q, msg.queue);
	config.del('queue');

	async.forEachSeries(Object.keys(q), function (el, cb) {
		var parts = el.split(' ');
		var id = parts[0];
		var path = parts[1];

		request(insight._getRequestObj(id, path), function (err) {
			if (err) {
				cb(err);
				return;
			}

			cb();
		});
	}, function (err) {
		if (err) {
			var q2 = config.get('queue') || {};
			assign(q2, q);
			config.set('queue', q2);
		}

		process.exit();
	});
});

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/insight/lib/push.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/insight/lib/push.js