xuxueli / xxl-job

A distributed task scheduling framework.(分布式任务调度平台XXL-JOB)
http://www.xuxueli.com/xxl-job/
GNU General Public License v3.0
27.47k stars 10.86k forks source link

旧服务下线的一段时间内,还是有任务会执行到这个机器节点上,有没有什么办法在新服务(和旧服务ip不通)上线的时候直接剔除旧的节点呢 #3442

Closed LiJun990105 closed 4 months ago

LiJun990105 commented 5 months ago

Please answer some questions before submitting your issue. Thanks!

Which version of XXL-JOB do you using?

Expected behavior

Actual behavior

Steps to reproduce the behavior

Other information

lushimin commented 5 months ago

服务器下线时,如果正常执行spring 自带的destroy()方法,执行器会向xxljob admin 发送一个http请求,最终执行com.xxl.job.admin.core.thread.JobRegistryHelper#registryRemove方法,该方法会在registry表中把当前节点去掉,但是不会更新group表,而实际调度是根据group表中的address_list来选择pod。group表中的地址信息是30s更新一次。所以最快也要30s。如果destroy()方法没有执行,只能等xxljob admin 90s没有收到心跳,再去registry表中把当前节点去掉,再更新group表。建议1、com.xxl.job.admin.core.thread.JobRegistryHelper#registryRemove方法中同步更新group表。 2、如果多次因为网络调度失败,将当前节点排除。