MCPcopy Create free account
hub / github.com/MG-RAST/Shock / RemoveOld

Method RemoveOld

shock-server/node/locker/locker.go:221–232  ·  view source on GitHub ↗
(hours int)

Source from the content-addressed store, hash-verified

219}
220
221func (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

Callers

nothing calls this directly

Calls 2

AddMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected