Revert "TEMP: gut out expensive queries"

This reverts commit 220a57da4c.

I just tested this against the live database, and everything seems to
work now.
This commit is contained in:
Michael Snoyman 2020-08-20 07:22:54 +03:00
parent 6eb463f20c
commit fbbf169e58
No known key found for this signature in database
GPG Key ID: 907EAE2F42B52046
4 changed files with 31 additions and 1 deletions

View File

@ -102,7 +102,7 @@ handlePackage epi = do
in if ms == authors
then []
else ms
mdisplayedVersion = Nothing
mdisplayedVersion = msppi >>= sppiVersion
defaultLayout $ do
setTitle $ toHtml pname
$(combineScripts 'StaticR [js_highlight_js])

View File

@ -503,6 +503,7 @@ getSnapshotPackagePageInfoQuery spi maxDisplayedDeps = do
if reverseDepsCount > 0
then getReverseDeps spi (Just maxDisplayedDeps)
else pure []
latestInfo <- getLatests (spiPackageName spi)
moduleNames <- getModuleNames (spiSnapshotPackageId spi)
mcabalBlobKey <- traverse getBlobKey $ spiCabalBlobId spi
pure
@ -513,6 +514,7 @@ getSnapshotPackagePageInfoQuery spi maxDisplayedDeps = do
, sppiForwardDepsCount = forwardDepsCount
, sppiReverseDeps = map (first dropVersionRev) reverseDeps
, sppiReverseDepsCount = reverseDepsCount
, sppiLatestInfo = latestInfo
, sppiModuleNames = moduleNames
, sppiPantryCabal =
mcabalBlobKey RIO.<&> \cabalBlobKey ->
@ -521,6 +523,16 @@ getSnapshotPackagePageInfoQuery spi maxDisplayedDeps = do
, pcVersion = spiVersion spi
, pcCabalKey = cabalBlobKey
}
, sppiVersion =
listToMaybe
[ spiVersionRev spi
| VersionRev ver mrev <-
maybe [] (pure . hciVersionRev) mhciLatest ++
map liVersionRev latestInfo
, ver > curVer ||
(ver == curVer &&
fromMaybe (Revision 0) mrev > fromMaybe (Revision 0) mcurRev)
]
}
where
VersionRev curVer mcurRev = spiVersionRev spi

View File

@ -249,8 +249,11 @@ data SnapshotPackagePageInfo = SnapshotPackagePageInfo
-- ^ Limited list of packages in the snapshot that depend on this package
, sppiReverseDepsCount :: !Int
-- ^ Count of all packages in the snapshot that depends on this package
, sppiLatestInfo :: ![LatestInfo]
, sppiModuleNames :: !(Map ModuleNameP Bool)
, sppiPantryCabal :: !(Maybe PantryCabal)
, sppiVersion :: !(Maybe VersionRev)
-- ^ Version on this page. Should be present only if different from latest
}
toRevMaybe :: Revision -> Maybe Revision

View File

@ -24,6 +24,21 @@ $newline never
#{url}
<table>
$maybe displayedVersion <- mdisplayedVersion
<tr>
<td align=right>Version on this page:
<td>
<span .version>#{displayedVersion}
$maybe sppi <- msppi
$forall li <- sppiLatestInfo sppi
<tr>
<td align="right">
<a href=@{SnapshotR (liSnapName li) StackageHomeR}>
#{snapshotPrettyNameShort (liSnapName li)}
:
<td>
<span .version>
<a href=@{SnapshotR (liSnapName li) (StackageSdistR (PNVName pname))}>#{liVersionRev li}
$maybe hciLatest <- mhciLatest
<tr>
<td align="right">Latest on Hackage: