-// Remove pods with a score of 0 (too many requests where they were unreachable)
-function removeBadPods () {
- async.waterfall([
- function findBadPods (callback) {
- Pod.listBadPods(function (err, pods) {
- if (err) {
- logger.error('Cannot find bad pods.', { error: err })
- return callback(err)
+function buildRequestObjects (requests) {
+ const requestsToMakeGrouped = {}
+
+ Object.keys(requests).forEach(function (toPodId) {
+ requests[toPodId].forEach(function (data) {
+ const request = data.request
+ const pod = data.pod
+ const hashKey = toPodId + request.endpoint
+
+ if (!requestsToMakeGrouped[hashKey]) {
+ requestsToMakeGrouped[hashKey] = {
+ toPod: pod,
+ endpoint: request.endpoint,
+ ids: [], // request ids, to delete them from the DB in the future
+ datas: [] // requests data,