Closed dxyinme closed 1 year ago
redis Driver 的 stopChan 属性可以直接改用一个全局的 ctx 来控制, 心跳和其他逻辑循环内只需要判断 <- ctx.Done() 或者 ctx.Err() 就可以了。
我大概修改了下 etcd 的 ctx 逻辑, 基本按照一个思路: start / stop 传入的 ctx 只影响 start/stop期间的操作,运行期间的ctx使用全局的ctx。
redis Driver 的 stopChan 属性可以直接改用一个全局的 ctx 来控制, 心跳和其他逻辑循环内只需要判断 <- ctx.Done() 或者 ctx.Err() 就可以了。