libi / dcron

轻量分布式定时任务库 a lightweight distributed job scheduler library
MIT License
446 stars 76 forks source link

Change redis driver in new implementation, add context supported. #50

Closed dxyinme closed 1 year ago

libi commented 1 year ago

redis Driver 的 stopChan 属性可以直接改用一个全局的 ctx 来控制, 心跳和其他逻辑循环内只需要判断 <- ctx.Done() 或者 ctx.Err() 就可以了。

libi commented 1 year ago

我大概修改了下 etcd 的 ctx 逻辑, 基本按照一个思路: start / stop 传入的 ctx 只影响 start/stop期间的操作,运行期间的ctx使用全局的ctx。