1234567891011121314151617181920212223 |
- 'use strict';
- // 弃用,因为不能同时进行握手,所以将节点查询合并到用户查询中
- const Subscription = require('egg').Subscription;
- class Creeper extends Subscription {
- // 通过 schedule 属性来设置定时任务的执行间隔等配置
- // 更改执行时间
- static get schedule() {
- return {
- // cron: '0 6 30 * * ?', // 每天晚上23点执行任务
- // cron: '0 28 18 * * ?', // 每天晚上23点执行任务
- interval: '1m', // 1分钟执行一次
- type: 'worker', // 指定所有的 worker 都需要执行
- };
- }
- // subscribe 是真正定时任务执行时被运行的函数
- async subscribe() {
- // console.log('服务器集群节点查询');
- // await this.ctx.service.creeperxtsqnode.creeper();// qnodes
- }
- }
- module.exports = Creeper;
|