Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var logger = require('morgan');
var Database = require('./classes/Database.js');
var getJSON = require('get-json');
var redis = require('async-redis').createClient();
const app_path = __dirname;
var indexRouter = require('./routes.js');
var app = express();
app.root = __dirname;
app.redis = redis;
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'pug');
app.enable('etag');
app.use(logger('dev'));
const server_started = Date.now();
/**
* @author xing7th@gmail.com
* @website http://www.showdoc.cc/htq
*/
const asyncRedis = require("async-redis");
const client = asyncRedis.createClient();
const fs = require('fs');
const fetch = require("node-fetch");
const config = JSON.parse(fs.readFileSync('./config.json').toString());
const redis_client = asyncRedis.createClient(config.redis_port,config.redis_host); //creates a new client
console.log("后台队列服务已经启动,随时等待新队列任务");
var queue_status_array = [];
//设置一个循环任务,1天检测一次。当队列空的时候,则停止本进程(父进程会重新启动本进程)
setInterval(function(){
var isDoing = 0 ;
for( let x in queue_status_array){
if (queue_status_array[x]) {
isDoing = 1 ;
};
}
if (! isDoing ){
process.exit();
};
},1*24*60*60*1000);
/**
* @author xing7th@gmail.com
* @website http://www.showdoc.cc/htq
*/
const asyncRedis = require("async-redis");
const client = asyncRedis.createClient();
const fs = require('fs');
const fetch = require("node-fetch");
const config = JSON.parse(fs.readFileSync('./config.json').toString());
const redis_client = asyncRedis.createClient(config.redis_port,config.redis_host); //creates a new client
console.log("后台队列服务已经启动,随时等待新队列任务");
var queue_status_array = [];
//设置一个循环任务,1天检测一次。当队列空的时候,则停止本进程(父进程会重新启动本进程)
setInterval(function(){
var isDoing = 0 ;
for( let x in queue_status_array){
if (queue_status_array[x]) {
isDoing = 1 ;
};
}
#!/usr/bin/env node
var Database = require('../classes/Database.js');
var getJSON = require('get-json');
var redis = require('async-redis').createClient();
var phin = require('phin').defaults({'method': 'get', 'headers': { 'User-Agent': 'evewho.com' } });
const app = {};
app.debug = false;
app.bailout = false;
app.error_count = 0;
app.phin = phin;
app.fetch = async function(url, parser, failure, options) {
try {
return await parser(app, await phin(url), options);
} catch (e) {
return failure(app, e);
}
};
app.redis = redis;
let redis = require('async-redis');
export const redisClient = redis.createClient({ host: 'redis', port: 6379 });