run: do not try to cache "top-level" journal more than once

This commit is contained in:
Dmitry Astapov 2025-02-23 12:55:12 +00:00 committed by Simon Michael
parent 5bd9be2189
commit 8431cbe95b

View File

@ -137,7 +137,9 @@ defaultJournalKey = "journal specified in args of run"
addJournalToCache :: Journal -> String -> IO ()
addJournalToCache j key = modifyMVar_ journalCache $ \cache ->
return $ Map.insert key j cache
case Map.lookup key cache of
Just _ -> return cache
Nothing -> return $ Map.insert key j cache
withJournalCached :: CliOpts -> (Journal -> IO ()) -> IO ()
withJournalCached cliopts cmd = do