mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 12:18:29 +01:00
Remove Hoogle lock
This commit is contained in:
parent
68fa14a4bb
commit
3d8cd6a115
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user