MCPcopy Index your code
hub / github.com/SignTools/SignTools / Cleanup

Method Cleanup

src/storage/upload_resolver.go:62–83  ·  view source on GitHub ↗
(timeout time.Duration)

Source from the content-addressed store, hash-verified

60}
61
62func (r *uploadResolver) Cleanup(timeout time.Duration) {
63 r.mu.Lock()
64 defer r.mu.Unlock()
65 now := time.Now()
66 var deleteList []Upload
67 for id, upload := range r.idToUploadMap {
68 modTime, err := upload.GetModTime()
69 if err != nil {
70 log.Err(err).Str("id", id).Msg("upload cleanup")
71 }
72 if now.After(modTime.Add(timeout)) {
73 deleteList = append(deleteList, upload)
74 }
75 }
76 for _, upload := range deleteList {
77 id := upload.GetId()
78 if err := upload.delete(); err != nil {
79 log.Err(err).Str("id", id).Msg("upload cleanup")
80 }
81 delete(r.idToUploadMap, id)
82 }
83}
84
85func (r *uploadResolver) Delete(id string) error {
86 r.mu.Lock()

Callers

nothing calls this directly

Calls 4

AddMethod · 0.80
GetModTimeMethod · 0.65
GetIdMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected