diff options
author | Joey Hess <joey@kitenet.net> | 2012-08-03 10:18:57 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-08-03 10:18:57 -0400 |
commit | 89120261e01418c938cbc8f32d66d8abe5b22283 (patch) | |
tree | e4469044b26c7a2a506fbacad628082faa856408 /Assistant/WebApp | |
parent | 02556b5acde495656de46b0cfc07310e91f4573e (diff) |
run the file browser in a separate thread to avoid blocking the browser
Diffstat (limited to 'Assistant/WebApp')
-rw-r--r-- | Assistant/WebApp/DashBoard.hs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Assistant/WebApp/DashBoard.hs b/Assistant/WebApp/DashBoard.hs index a1e499d70..8e526fb1d 100644 --- a/Assistant/WebApp/DashBoard.hs +++ b/Assistant/WebApp/DashBoard.hs @@ -28,6 +28,7 @@ import qualified Git import Yesod import Text.Hamlet import qualified Data.Map as M +import Control.Concurrent {- A display of currently running and queued transfers. - @@ -104,13 +105,19 @@ getFileBrowserR = whenM openFileBrowser $ do {- Opens the system file browser on the repo, or, as a fallback, - goes to a file:// url. Returns True if it's ok to redirect away - - from the page (ie, the system file browser was opened). -} + - from the page (ie, the system file browser was opened). + - + - Note that the command is opened using a different thread, to avoid + - blocking the response to the browser on it. -} openFileBrowser :: Handler Bool openFileBrowser = do path <- runAnnex (error "no configured repository") $ fromRepo Git.repoPath - ifM (liftIO $ inPath cmd <&&> boolSystem cmd [File path]) - ( return True + ifM (liftIO $ inPath cmd <&&> inPath cmd) + ( do + void $ liftIO $ forkIO $ void $ + boolSystem cmd [Param path] + return True , do clearUltDest setUltDest $ "file://" ++ path |