|
@@ -27,94 +27,94 @@ class APIModule extends CoreClass {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
- response.app.get("/debug_station", async (req, res) => {
|
|
|
|
- const responseObject = {};
|
|
|
|
-
|
|
|
|
- const stationModel = await this.db.runJob(
|
|
|
|
- "GET_MODEL",
|
|
|
|
- {
|
|
|
|
- modelName: "station",
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- async.waterfall([
|
|
|
|
- next => {
|
|
|
|
- stationModel.find({}, next);
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- (stations, next) => {
|
|
|
|
- responseObject.mongo = {
|
|
|
|
- stations
|
|
|
|
- };
|
|
|
|
- next();
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- next => {
|
|
|
|
- this.cache
|
|
|
|
- .runJob("HGETALL", { table: "stations" })
|
|
|
|
- .then(stations => {
|
|
|
|
- next(null, stations);
|
|
|
|
- })
|
|
|
|
- .catch(next);
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- (stations, next) => {
|
|
|
|
- responseObject.redis = {
|
|
|
|
- stations
|
|
|
|
- };
|
|
|
|
- next();
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- next => {
|
|
|
|
- responseObject.cryptoExamples = {};
|
|
|
|
- responseObject.mongo.stations.forEach(station => {
|
|
|
|
- const payloadName = `stations.nextSong?id=${station._id}`;
|
|
|
|
- responseObject.cryptoExamples[station._id] = crypto
|
|
|
|
- .createHash("md5")
|
|
|
|
- .update(`_notification:${payloadName}_`)
|
|
|
|
- .digest("hex")
|
|
|
|
- });
|
|
|
|
- next();
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- next => {
|
|
|
|
- this.notifications.pub.keys("*", next);
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- (redisKeys, next) => {
|
|
|
|
- responseObject.redis = {
|
|
|
|
- ...redisKeys,
|
|
|
|
- ttl: {}
|
|
|
|
- };
|
|
|
|
- async.eachLimit(redisKeys, 1, (redisKey, next) => {
|
|
|
|
- this.notifications.pub.ttl(redisKey, (err, ttl) => {
|
|
|
|
- responseObject.redis.ttl[redisKey] = ttl;
|
|
|
|
- next(err);
|
|
|
|
- })
|
|
|
|
- }, next);
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- next => {
|
|
|
|
- responseObject.debugLogs = this.moduleManager.debugLogs.stationIssue;
|
|
|
|
- next();
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- next => {
|
|
|
|
- responseObject.debugJobs = this.moduleManager.debugJobs;
|
|
|
|
- next();
|
|
|
|
- }
|
|
|
|
- ], (err, response) => {
|
|
|
|
- if (err) {
|
|
|
|
- console.log(err);
|
|
|
|
- return res.json({
|
|
|
|
- error: err,
|
|
|
|
- objectSoFar: responseObject
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- res.json(responseObject);
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ // response.app.get("/debug_station", async (req, res) => {
|
|
|
|
+ // const responseObject = {};
|
|
|
|
+
|
|
|
|
+ // const stationModel = await this.db.runJob(
|
|
|
|
+ // "GET_MODEL",
|
|
|
|
+ // {
|
|
|
|
+ // modelName: "station",
|
|
|
|
+ // }
|
|
|
|
+ // );
|
|
|
|
+
|
|
|
|
+ // async.waterfall([
|
|
|
|
+ // next => {
|
|
|
|
+ // stationModel.find({}, next);
|
|
|
|
+ // },
|
|
|
|
+
|
|
|
|
+ // (stations, next) => {
|
|
|
|
+ // responseObject.mongo = {
|
|
|
|
+ // stations
|
|
|
|
+ // };
|
|
|
|
+ // next();
|
|
|
|
+ // },
|
|
|
|
+
|
|
|
|
+ // next => {
|
|
|
|
+ // this.cache
|
|
|
|
+ // .runJob("HGETALL", { table: "stations" })
|
|
|
|
+ // .then(stations => {
|
|
|
|
+ // next(null, stations);
|
|
|
|
+ // })
|
|
|
|
+ // .catch(next);
|
|
|
|
+ // },
|
|
|
|
+
|
|
|
|
+ // (stations, next) => {
|
|
|
|
+ // responseObject.redis = {
|
|
|
|
+ // stations
|
|
|
|
+ // };
|
|
|
|
+ // next();
|
|
|
|
+ // },
|
|
|
|
+
|
|
|
|
+ // next => {
|
|
|
|
+ // responseObject.cryptoExamples = {};
|
|
|
|
+ // responseObject.mongo.stations.forEach(station => {
|
|
|
|
+ // const payloadName = `stations.nextSong?id=${station._id}`;
|
|
|
|
+ // responseObject.cryptoExamples[station._id] = crypto
|
|
|
|
+ // .createHash("md5")
|
|
|
|
+ // .update(`_notification:${payloadName}_`)
|
|
|
|
+ // .digest("hex")
|
|
|
|
+ // });
|
|
|
|
+ // next();
|
|
|
|
+ // },
|
|
|
|
+
|
|
|
|
+ // next => {
|
|
|
|
+ // this.notifications.pub.keys("*", next);
|
|
|
|
+ // },
|
|
|
|
+
|
|
|
|
+ // (redisKeys, next) => {
|
|
|
|
+ // responseObject.redis = {
|
|
|
|
+ // ...redisKeys,
|
|
|
|
+ // ttl: {}
|
|
|
|
+ // };
|
|
|
|
+ // async.eachLimit(redisKeys, 1, (redisKey, next) => {
|
|
|
|
+ // this.notifications.pub.ttl(redisKey, (err, ttl) => {
|
|
|
|
+ // responseObject.redis.ttl[redisKey] = ttl;
|
|
|
|
+ // next(err);
|
|
|
|
+ // })
|
|
|
|
+ // }, next);
|
|
|
|
+ // },
|
|
|
|
+
|
|
|
|
+ // next => {
|
|
|
|
+ // responseObject.debugLogs = this.moduleManager.debugLogs.stationIssue;
|
|
|
|
+ // next();
|
|
|
|
+ // },
|
|
|
|
+
|
|
|
|
+ // next => {
|
|
|
|
+ // responseObject.debugJobs = this.moduleManager.debugJobs;
|
|
|
|
+ // next();
|
|
|
|
+ // }
|
|
|
|
+ // ], (err, response) => {
|
|
|
|
+ // if (err) {
|
|
|
|
+ // console.log(err);
|
|
|
|
+ // return res.json({
|
|
|
|
+ // error: err,
|
|
|
|
+ // objectSoFar: responseObject
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // res.json(responseObject);
|
|
|
|
+ // });
|
|
|
|
+ // });
|
|
|
|
|
|
// Object.keys(actions).forEach(namespace => {
|
|
// Object.keys(actions).forEach(namespace => {
|
|
// Object.keys(actions[namespace]).forEach(action => {
|
|
// Object.keys(actions[namespace]).forEach(action => {
|