@@ -22,6 +22,7 @@ import (
2222 "pika/codis/v2/pkg/utils/math2"
2323 "pika/codis/v2/pkg/utils/redis"
2424 "pika/codis/v2/pkg/utils/rpc"
25+ gxruntime "pika/codis/v2/pkg/utils/runtime"
2526 "pika/codis/v2/pkg/utils/sync2/atomic2"
2627)
2728
@@ -197,7 +198,7 @@ func (s *Topom) Start(routines bool) error {
197198 }
198199
199200 // Check the status of all masters and slaves every 5 seconds
200- go func () {
201+ gxruntime . GoUnterminated ( func () {
201202 for ! s .IsClosed () {
202203 if s .IsOnline () {
203204 w , _ := s .CheckMastersAndSlavesState (10 * time .Second )
@@ -207,11 +208,11 @@ func (s *Topom) Start(routines bool) error {
207208 }
208209 time .Sleep (s .Config ().SentinelCheckServerStateInterval .Duration ())
209210 }
210- }( )
211+ }, nil , true , 0 )
211212
212213 // Check the status of the pre-offline master every 1 second
213214 // to determine whether to automatically switch master and slave
214- go func () {
215+ gxruntime . GoUnterminated ( func () {
215216 for ! s .IsClosed () {
216217 if s .IsOnline () {
217218 w , _ := s .CheckPreOffineMastersState (5 * time .Second )
@@ -221,9 +222,9 @@ func (s *Topom) Start(routines bool) error {
221222 }
222223 time .Sleep (s .Config ().SentinelCheckMasterFailoverInterval .Duration ())
223224 }
224- }( )
225+ }, nil , true , 0 )
225226
226- go func () {
227+ gxruntime . GoUnterminated ( func () {
227228 for ! s .IsClosed () {
228229 if s .IsOnline () {
229230 w , _ := s .RefreshRedisStats (time .Second )
@@ -233,9 +234,9 @@ func (s *Topom) Start(routines bool) error {
233234 }
234235 time .Sleep (time .Second )
235236 }
236- }( )
237+ }, nil , true , 0 )
237238
238- go func () {
239+ gxruntime . GoUnterminated ( func () {
239240 for ! s .IsClosed () {
240241 if s .IsOnline () {
241242 w , _ := s .RefreshProxyStats (time .Second )
@@ -245,9 +246,9 @@ func (s *Topom) Start(routines bool) error {
245246 }
246247 time .Sleep (time .Second )
247248 }
248- }( )
249+ }, nil , true , 0 )
249250
250- go func () {
251+ gxruntime . GoUnterminated ( func () {
251252 for ! s .IsClosed () {
252253 if s .IsOnline () {
253254 if err := s .ProcessSlotAction (); err != nil {
@@ -257,9 +258,9 @@ func (s *Topom) Start(routines bool) error {
257258 }
258259 time .Sleep (time .Second )
259260 }
260- }( )
261+ }, nil , true , 0 )
261262
262- go func () {
263+ gxruntime . GoUnterminated ( func () {
263264 for ! s .IsClosed () {
264265 if s .IsOnline () {
265266 if err := s .ProcessSyncAction (); err != nil {
@@ -269,7 +270,7 @@ func (s *Topom) Start(routines bool) error {
269270 }
270271 time .Sleep (time .Second )
271272 }
272- }( )
273+ }, nil , true , 0 )
273274
274275 return nil
275276}
0 commit comments