5562: Use static method. Fixes "TypeError: _socket_open() takes exactly 5 arguments...
[arvados.git] / services / keepstore / trash_worker.go
index 72b9a4663adb0099a7068cfd2e0f0f9ac4228f77..ca269126ee61f2a225b3a9a55a830ebfc51c9a97 100644 (file)
@@ -29,15 +29,14 @@ func RunTrashWorker(trashq *WorkQueue) {
 */
 func TrashItem(trashRequest TrashRequest) (err error) {
        // Verify if the block is to be deleted based on its Mtime
-       for _, volume := range KeepVM.Volumes() {
+       for _, volume := range KeepVM.AllWritable() {
                mtime, err := volume.Mtime(trashRequest.Locator)
-               if err == nil {
-                       if trashRequest.BlockMtime == mtime.Unix() {
-                               currentTime := time.Now().Unix()
-                               if time.Duration(currentTime-trashRequest.BlockMtime)*time.Second >= permission_ttl {
-                                       err = volume.Delete(trashRequest.Locator)
-                               }
-                       }
+               if err != nil || trashRequest.BlockMtime != mtime.Unix() {
+                       continue
+               }
+               currentTime := time.Now().Unix()
+               if time.Duration(currentTime-trashRequest.BlockMtime)*time.Second >= permission_ttl {
+                       err = volume.Delete(trashRequest.Locator)
                }
        }
        return