@@ -139,7 +139,6 @@ runPlotM fmt conf v = do
139139 cwd <- getCurrentDirectory
140140 st <-
141141 PlotState <$> newMVar mempty
142- <*> newMVar mempty
143142 let verbosity = logVerbosity conf
144143 sink = logSink conf
145144 withLogger verbosity sink $
@@ -222,27 +221,23 @@ throwStrictError msg = do
222221 logger <- askLogger
223222 liftIO $ terminateLogging logger >> exitFailure
224223
225- -- Plot state is used for caching.
226- -- One part consists of a map of filepaths to hashes
224+ -- Plot state is used for caching a map of filepaths to hashes
227225-- This allows multiple plots to depend on the same file/directory, and the file hashes
228226-- will only be calculated once. This is OK because pandoc-plot will not run for long.
229227-- We note that because figures are rendered possibly in parallel, access to
230228-- the state must be synchronized; otherwise, each thread might compute its own
231229-- hashes.
232- -- The other part is comprised of a map of toolkits to renderers (possibly missing)
233- -- This means that checking if renderers are available will only be done once.
234230type FileHash = Word
235231
236232data PlotState
237233 = PlotState
238234 (MVar (Map FilePath FileHash ))
239- (MVar (Map Toolkit (Maybe Renderer )))
240235
241236-- | Get a filehash. If the file hash has been computed before,
242237-- it is reused. Otherwise, the filehash is calculated and stored.
243238fileHash :: FilePath -> PlotM FileHash
244239fileHash path = do
245- PlotState varHashes varExes <- get
240+ PlotState varHashes <- get
246241 hashes <- liftIO $ takeMVar varHashes
247242 (fh, hashes') <- case M. lookup path hashes of
248243 Nothing -> do
@@ -254,7 +249,7 @@ fileHash path = do
254249 debug $ mconcat [" Hash of dependency " , pack path, " already calculated." ]
255250 return (h, hashes)
256251 liftIO $ putMVar varHashes hashes'
257- put $ PlotState varHashes varExes
252+ put $ PlotState varHashes
258253 return fh
259254 where
260255 -- As a proxy for the state of a file dependency, we use the modification time
0 commit comments