Promise .all([ queryCollaborators({ repositoryOwner, repositoryName }), queryCommits({ repositoryOwner, repositoryName, since }) ]) .then(results => { const collaborators = _.keyBy(results[0], 'login') return _.chain(results[1]) .map('author.user') .reject(_.isEmpty) .groupBy('login') .map(group => _.defaults({ commits: _.size(group) }, _.head(group))) .filter(user => _.isEmpty(collaborators[user.login])) .value() }) .then(res => formatOutput(res)) .catch(err => console.log(err))
_.chain(this._messageBuffer).groupBy('channelName').map((messages, channelName) => { this._debug('Draining %s messages', this._messageBuffer.length); superagent.post('http://'+ this._parent._conf.nginx.host +':'+ this._parent._conf.nginx.port +'/pub') .agent(this._parent._agent) .query({id: channelName}) .send(_.map(messages, 'message')) .end((err, data) => { if (err) { logger.captureError(logger.error('Sending messages to Redis', {err})) } this._debug('Sent %s messages to nginx on channel %s', messages.length, channelName); }); }).value()
}; this._drain = function () { _.chain(_this._messageBuffer).groupBy('channelName').map(function (messages, channelName) { _this._debug('Draining %s messages', _this._messageBuffer.length); superagent.post('http://' + _this._parent._conf.nginx.host + ':' + _this._parent._conf.nginx.port + '/pub') .agent(_this._parent._agent) .query({ id: channelName }) .send(_.map(messages, 'message')) .end(function (err, data) { if (err) {
Promise .all([ queryCollaborators({ repositoryOwner, repositoryName }), queryCommits({ repositoryOwner, repositoryName, since }) ]) .then(results => { const collaborators = _.keyBy(results[0], 'login') return _.chain(results[1]) .map('author.user') .reject(_.isEmpty) .groupBy('login') .map(group => _.defaults({ commits: _.size(group) }, _.head(group))) .filter(user => _.isEmpty(collaborators[user.login])) .value() }) .then(res => formatOutput(res)) .catch(err => console.log(err))