Skip to content

Conversation

@newhoggy
Copy link
Collaborator

No description provided.

@newhoggy newhoggy force-pushed the newhoggy/timeout-removePathForcibly branch from 9b00685 to 7a3250b Compare June 28, 2025 07:12
@newhoggy newhoggy force-pushed the newhoggy/timeout-removePathForcibly branch from 7a3250b to cdbc1a4 Compare June 28, 2025 10:36
@newhoggy newhoggy changed the title Newhoggy/timeout remove path forcibly Timeout removePathForcibly in moduleWorkspace Jun 28, 2025
Comment on lines +213 to +218
GHC.withFrozenCallStack $ do
result <- try (liftIO (IO.timeout (5 * 1000) (IO.removePathForcibly ws)))
case result of
Right (Just ()) -> return ()
Right Nothing -> pure ()
Left (_ :: IOException) -> do
Copy link
Contributor

@carbolymer carbolymer Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Readability could be improved here:

Suggested change
GHC.withFrozenCallStack $ do
result <- try (liftIO (IO.timeout (5 * 1000) (IO.removePathForcibly ws)))
case result of
Right (Just ()) -> return ()
Right Nothing -> pure ()
Left (_ :: IOException) -> do
GHC.withFrozenCallStack $ do
catch
(timeout (5_000) (liftIO $ IO.removePathForcibly ws))
$ \(_ :: IOException) -> do

from lifted-base: catch, timeout.

5 ms seems to be not much here. I'd increase it an order of magnitude, just to be on the safe side.

Left (_ :: IOException) -> do
if retries > 0
then do
liftIO (IO.threadDelay 100000) -- wait 100ms before retrying
Copy link
Contributor

@carbolymer carbolymer Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: use lifted-base:

Suggested change
liftIO (IO.threadDelay 100000) -- wait 100ms before retrying
threadDelay 100_000 -- wait 100ms before retrying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants