()
| 66 | } |
| 67 | |
| 68 | func (m *PathManager) removeTask() { |
| 69 | defer func() { |
| 70 | if err := recover(); err != nil { |
| 71 | m.logger.Errorf("remove task panic : %s", err) |
| 72 | } |
| 73 | }() |
| 74 | var emptyT int |
| 75 | for { |
| 76 | select { |
| 77 | case path, ok := <-m.clearCh: |
| 78 | if !ok { |
| 79 | m.logger.Infof("clear chan has been closed") |
| 80 | break |
| 81 | } |
| 82 | emptyT = 0 |
| 83 | m.logger.V(8).Infof("remove by path name %s start", path) |
| 84 | err := m.RemoveByPathName(path) |
| 85 | if err != nil { |
| 86 | // unexpected error |
| 87 | m.logger.Errorf("remove by path name %s failed: %s", path, err) |
| 88 | } else { |
| 89 | m.logger.V(8).Infof("remove by path name %s success", path) |
| 90 | } |
| 91 | default: |
| 92 | time.Sleep(time.Duration(emptyT) * time.Second) |
| 93 | emptyT++ |
| 94 | } |
| 95 | |
| 96 | } |
| 97 | } |
no test coverage detected