saveStatusLoop marshals the remaining sync tasks into leveldb.
()
| 438 | |
| 439 | // saveStatusLoop marshals the remaining sync tasks into leveldb. |
| 440 | func (s *SyncClient) saveStatusLoop() { |
| 441 | defer s.wg.Done() |
| 442 | |
| 443 | ticker := time.NewTicker(5 * time.Minute) |
| 444 | defer ticker.Stop() |
| 445 | for { |
| 446 | select { |
| 447 | case <-ticker.C: |
| 448 | s.saveSyncStatus() |
| 449 | case <-s.resCtx.Done(): |
| 450 | s.lg.Info("Stopped P2P sync client save status") |
| 451 | return |
| 452 | } |
| 453 | } |
| 454 | } |
| 455 | |
| 456 | // cleanTasks removes kv range retrieval tasks that have already been completed. |
| 457 | func (s *SyncClient) cleanTasks() { |
no test coverage detected