avoid unncessary locking by checkLogFile
authorJoey Hess <joeyh@joeyh.name>
Fri, 23 Sep 2022 18:01:43 +0000 (14:01 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 23 Sep 2022 18:01:43 +0000 (14:01 -0400)
Like the comment says, this works without locking. It looks like I
originally copied another function and forgot to remove the locking.

Sponsored-by: Dartmouth College's DANDI project
Command/Move.hs
Logs/File.hs

index efb02b7c2f65eea5f40591d7e84826a7cdd48221..55fed5c37260114a3c6f7ceca558ee612615c24e 100644 (file)
@@ -396,8 +396,7 @@ logMove srcuuid destuuid deststartedwithcopy key a = go =<< setup
        go logf
                -- Only need to check log when there is a copy.
                | deststartedwithcopy = do
-                       lck <- fromRepo gitAnnexMoveLock
-                       wasnocopy <- checkLogFile (fromRawFilePath logf) lck
+                       wasnocopy <- checkLogFile (fromRawFilePath logf)
                                (== logline)
                        if wasnocopy
                                then go' logf False
index 87e479ae7c3b5e96e313a266d55e7b1adabae04f..76223991087ea6945a2bc4a6bb55ded42f34b778 100644 (file)
@@ -88,8 +88,8 @@ modifyLogFile f lck modf = withExclusiveLock lck $ do
 -- action is concurrently modifying the file. It does not lock the file,
 -- for speed, but instead relies on the fact that a log file usually
 -- ends in a newline.
-checkLogFile :: FilePath -> RawFilePath -> (L.ByteString -> Bool) -> Annex Bool
-checkLogFile f lck matchf = withExclusiveLock lck $ bracket setup cleanup go
+checkLogFile :: FilePath -> (L.ByteString -> Bool) -> Annex Bool
+checkLogFile f matchf = bracket setup cleanup go
   where
        setup = liftIO $ tryWhenExists $ openFile f ReadMode
        cleanup Nothing = noop