cache remote.log

Unlikely to speed up any of the existing uses much, but I want to use it
in a message that might be displayed many times.
This commit is contained in:
Joey Hess 2020-09-22 13:52:26 -04:00
parent ebdce707da
commit 5cfcf1f05f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
19 changed files with 62 additions and 29 deletions

View file

@ -209,7 +209,7 @@ postEnableSshGitRemoteR = enableSshRemote getsshinput enableRsyncNet enablesshgi
-}
enableSshRemote :: (RemoteConfig -> Maybe SshData) -> (SshInput -> RemoteName -> Handler Html) -> (SshData -> UUID -> Handler Html) -> UUID -> Handler Html
enableSshRemote getsshdata rsyncnetsetup genericsetup u = do
m <- fromMaybe M.empty . M.lookup u <$> liftAnnex readRemoteLog
m <- fromMaybe M.empty . M.lookup u <$> liftAnnex remoteConfigMap
case (unmangle <$> getsshdata m, lookupName m) of
(Just sshdata, Just reponame) -> sshConfigurator $ do
((result, form), enctype) <- liftH $
@ -424,7 +424,7 @@ getConfirmSshR sshdata u
-- Not a UUID we know, so prompt about combining.
$(widgetFile "configurators/ssh/combine")
handleexisting (Just _) = prepSsh False sshdata $ \sshdata' -> do
m <- liftAnnex readRemoteLog
m <- liftAnnex remoteConfigMap
case fromProposedAccepted <$> (M.lookup typeField =<< M.lookup u m) of
Just "gcrypt" -> combineExistingGCrypt sshdata' u
_ -> makeSshRepo ExistingRepo sshdata'
@ -545,7 +545,7 @@ makeSshRepo rs sshdata
-- Record the location of the ssh remote in the remote log, so it
-- can easily be enabled elsewhere using the webapp.
setup r = do
m <- readRemoteLog
m <- remoteConfigMap
let c = fromMaybe M.empty (M.lookup (Remote.uuid r) m)
let c' = M.insert (Proposed "location") (Proposed (genSshUrl sshdata)) $
M.insert typeField (Proposed "git") $