creeperxtsqnode.js 810 B

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