(hours int)
| 219 | } |
| 220 | |
| 221 | func (f *FileLocker) RemoveOld(hours int) { |
| 222 | f.Lock() |
| 223 | defer f.Unlock() |
| 224 | currTime := time.Now() |
| 225 | expireTime := currTime.Add(time.Duration(hours*-1) * time.Hour) |
| 226 | for id, info := range f.nodes { |
| 227 | if info.CreatedOn.Before(expireTime) { |
| 228 | logger.Error(fmt.Sprintf("Removing stale file lock: node=%s", id)) |
| 229 | delete(f.nodes, id) |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | // ############## IndexLocker ############## |
| 235 |