-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
65 lines (46 loc) · 1.03 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
'use strict';
const sc = require("./lib/yz_schedule.js"); // -- you code here require is 'sdb_schedule'
const ioredis = require('ioredis');
let parModule = {
test:10000,
};
let logger = {
info:(...msg)=>{ console.log('--- [sche info]:',...msg); },
warn:(...msg)=>{ console.log('--- [sche warn]:',...msg); }
};
/** File config Manager */
// const app = sc({
// 'cfg_drv':'filedrv.js',
// 'cfg_opt':{
// 'cfgFile':"./config.json"
// },
// logger
// }, parModule);
/** end file config */
/* redis config Manager*/
const g_redis = { ins:null};
const app = sc({
cfg_drv:'redisdrv.js',
cfg_opt:{
//host:"127.0.0.1",
host:"192.168.2.10",
port:6379,
keyPre:'sdb:schedule',
checkInterval:5000,
instanse: g_redis
},
logger
}, parModule);
g_redis.ins = new ioredis( {
host:"192.168.2.10",
port:6379
} );
g_redis.ins.on("error",function( err ){
logger.warn("redis Error " + err);
});
/** end redis config */
process.on('SIGINT', function () {
console.log('Got SIGINT. exit.');
app.stop();
});
app.run();