Commit 932b2396 authored by 郝聪敏's avatar 郝聪敏

添加redlock

parent 150ee165
This diff is collapsed.
......@@ -2,13 +2,13 @@
module.exports = {
schedule: {
cron: '*/1 * * * * *',
cron: '*/10 * * * * *',
type: 'worker',
immediate: true,
},
async task() {
// ctx.logger.info('定时任务开始');
// await ctx.service.home.sendMail();
// await ctx.service.home.schedule();
// ctx.logger.info('定时任务结束');
},
};
This diff is collapsed.
......@@ -82,10 +82,48 @@ module.exports = appInfo => {
},
};
const redisConfig = {
redis: {
client: {
sentinels: [
{
host: 'opapi-redis1.quantgroups.com',
port: 26379,
},
{
host: 'opapi-redis2.quantgroups.com',
port: 26379,
},
{
host: 'opapi-redis3.quantgroups.com',
port: 26379,
},
],
name: 'mymaster',
password: '',
db: 0,
},
},
};
const redlock = {
redlock9: {
logger: app => e => app.info(e.message), // logger when lock failed, can be false
options: {
driftFactor: 0.01, // time in ms
retryCount: 0,
retryDelay: 200, // time in ms
retryJitter: 200, // time in ms
},
},
};
return {
...config,
...userConfig,
...mailConfig,
...fdfsConfig,
...redisConfig,
...redlock,
};
};
......@@ -2,12 +2,16 @@
/** @type Egg.EggPlugin */
module.exports = {
// had enabled by egg
// static: {
// enable: true,
// }
amqplib: {
enable: true,
package: 'egg-amqplib',
},
redis: {
enable: true,
package: 'egg-redis',
},
redlock9: {
enable: true,
package: 'egg-redlock-9',
},
};
......@@ -9,6 +9,8 @@
"dependencies": {
"egg": "^2.15.1",
"egg-amqplib": "^2.0.4",
"egg-redis": "^2.4.0",
"egg-redlock-9": "^1.0.1",
"egg-scripts": "^2.11.0",
"fdfs": "^1.0.4",
"nodemailer-promise": "^2.0.0",
......@@ -27,7 +29,7 @@
"node": ">=10.0.0"
},
"scripts": {
"start": "egg-scripts start --title=egg-server-puppeteer",
"start": "egg-scripts start --port=80 --title=egg-server-puppeteer",
"stop": "egg-scripts stop --title=egg-server-puppeteer",
"dev": "egg-bin dev",
"debug": "egg-bin debug",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment