Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = (node) => setInterval(() =>
each(node.peerBook.getAllArray(), (peerInfo, cb) => {
if (
// node was in the list when last round of heartbeat started
// make sure that it is still here
!node.peerBook.getAll()[peerInfo.id.toB58String()] ||
// check whether node was seen recently
Date.now() - (node.peerBook.getAll()[peerInfo.id.toB58String()].lastSeen || 0) <= THIRTY_ONE_SECONDS
)
return cb()
waterfall([
(cb) => {
if (!peerInfo.isConnected() || peerInfo.multiaddrs.size < 1)
return node.peerRouting.findPeer(peerInfo.id, cb)
cb(null, peerInfo)
},
readFn(data.cacheKey, function (readErr, cacheData) {
if (readErr) {
callback();
return;
}
if (cacheData.remainingRequest !== remainingRequest) {
// in case of a hash conflict
callback();
return;
}
var FS = _this.fs || fs;
async.each(cacheData.dependencies.concat(cacheData.contextDependencies), function (dep, eachCallback) {
FS.stat(dep.path, function (statErr, stats) {
if (statErr) {
eachCallback(statErr);
return;
}
if (stats.mtime.getTime() !== dep.mtime) {
eachCallback(true);
return;
}
eachCallback();
});
}, function (err) {
if (err) {
data.startTime = Date.now();
callback();
return;
"weights": function(callback) {
async.each(self.connections.incoming, function(connection, callback) {
connection.weight = connection.weight - random.scale() * random.scale() * random.scale()
callback()
}, callback)
// Passes reference to iteratee
/*
async.each(self.connections.incoming, function(connection, callback) {
connection.weight = connection.weight - random.scale() * random.scale() * random.scale()
callback()
}, callback)
*/
// Passes reference to iteratee (another option)
/*
async.times(self.connections.incoming.length, function(index, callback) {
self.connections.incoming[index].weight = self.connections.incoming[index].weight - random.scale() * random.scale() * random.scale()
module.exports = function writePages(
{ configurationPaths, environment, pages, outputPath, templates },
finalCb
) {
const antwarConfiguration = mergeConfiguration(
defaultAntwar(),
require(configurationPaths.antwar)(environment)
);
async.each(
pages,
({ page, path }, cb) =>
processPage(
{
configurationPaths,
antwarConfiguration,
page,
path,
outputPath,
templates,
},
cb
),
finalCb
);
};
function (deviceToken, next) {
debug("Registering device token: " + deviceToken);
async.each(
channels,
function (channel, next) {
debug("For channel: " + channel);
self.requestsManager.register(deviceToken, channel, function (err) {
if ( err )
data.unregistered.push({ device_token: deviceToken, channel: channel, error: err });
else
data.registered.push({ device_token: deviceToken, channel: channel });
next();
});
},
function (err) { next(err); }
);
},
function registerDeviceTokens(deviceTokens, callback, self) {
var data = {
registered : [],
unregistered: []
};
async.each(
deviceTokens,
function (deviceToken, next) {
debug("Registering device token: " + deviceToken);
self.requestsManager.register(deviceToken, null, function (err) {
if ( err )
data.unregistered.push({ device_token: deviceToken, error: err });
else
data.registered.push({ device_token: deviceToken });
next();
});
},
function (err) { callback(err, data); }
);
}
function benchNeoEach (done) {
neo.each([1, 2, 3], somethingP, done)
}
'neo-async': function(callback) {
c = 0;
neo_async.each(array, iterator, callback);
}
};
'neo-async_v0': function(callback) {
neo_async_v0.each(array, iterator, callback);
},
'neo-async_v1': function(callback) {