Remove Hoogle lock

This commit is contained in:
Michael Snoyman 2020-09-03 16:03:01 +03:00
parent 68fa14a4bb
commit 3d8cd6a115
No known key found for this signature in database
GPG Key ID: 907EAE2F42B52046
3 changed files with 1 additions and 10 deletions

View File

@ -160,7 +160,6 @@ withFoundation appLogFunc appSettings inner = do
\oldMatcher -> getLatestMatcher appHttpManager `catchAny` \e -> do
runRIO appLogFunc $ RIO.logError $ "Couldn't get Stack matcher: " <> displayShow e
pure oldMatcher
appHoogleLock <- newMVar ()
appMirrorStatus <- mkUpdateMirrorStatus
hoogleLocker <- newHoogleLocker appLogFunc appHttpManager
let appGetHoogleDB = singleRun hoogleLocker

View File

@ -35,9 +35,6 @@ data App = App
, appStackageDatabase :: !StackageDatabase
, appLatestStackMatcher :: !(IO (Text -> Maybe Text))
-- ^ Give a pattern, get a URL
, appHoogleLock :: !(MVar ())
-- ^ Avoid concurrent Hoogle queries, see
-- https://github.com/fpco/stackage-server/issues/172
, appMirrorStatus :: !(IO (Status, WidgetFor App ()))
, appGetHoogleDB :: !(SnapName -> IO (Maybe FilePath))
, appGitRev :: !GitRev

View File

@ -47,9 +47,6 @@ getHoogleR name0 = track "Handler.Hoogle.getHoogleR" do
mdatabasePath <- getHoogleDB name
dbPath <- maybe (hoogleDatabaseNotAvailableFor name) return mdatabasePath
-- Avoid concurrent Hoogle queries, see
-- https://github.com/fpco/stackage-server/issues/172
lock <- appHoogleLock <$> getYesod
urlRender <- getUrlRender
HoogleQueryOutput results mtotalCount <-
case mquery of
@ -64,9 +61,7 @@ getHoogleR name0 = track "Handler.Hoogle.getHoogleR" do
, hqiExact = exact
}
liftIO $ withMVar lock
$ const
$ Hoogle.withDatabase dbPath
liftIO $ Hoogle.withDatabase dbPath
-- NB! I got a segfault when I didn't force with $!
$ \db -> return $! runHoogleQuery urlRender name db input
Nothing -> return $ HoogleQueryOutput [] Nothing