speed hack
Avoids the external program being started just to use LISTCONFIGS on an already accepted config. So initremote/enableremote will still run the external program an extra time to use LISTCONFIGS, but everything that uses the special remote after it's initialized will not any longer.
This commit is contained in:
parent
b1c224dd48
commit
8406ff8861
1 changed files with 9 additions and 3 deletions
|
@ -177,7 +177,7 @@ externalSetup _ mu _ c gc = do
|
|||
-- Now that we have an external, ask it to LISTCONFIGS,
|
||||
-- and re-parse the RemoteConfig strictly, so we can
|
||||
-- error out if the user provided an unexpected config.
|
||||
either giveup return . parseRemoteConfig c'
|
||||
_ <- either giveup return . parseRemoteConfig c'
|
||||
=<< strictRemoteConfigParser external
|
||||
handleRequest external INITREMOTE Nothing $ \resp -> case resp of
|
||||
INITREMOTE_SUCCESS -> result ()
|
||||
|
@ -816,8 +816,11 @@ listConfigs external = handleRequest external LISTCONFIGS Nothing (collect [])
|
|||
|
||||
remoteConfigParser :: RemoteConfig -> Annex RemoteConfigParser
|
||||
remoteConfigParser c
|
||||
-- No need to ask when there is no config to parse.
|
||||
| M.null c = return lenientRemoteConfigParser
|
||||
-- No need to start the external when there is no config to parse,
|
||||
-- or when everything in the config was already accepted; in those
|
||||
-- cases the lenient parser will do the same thing as the strict
|
||||
-- parser.
|
||||
| M.null (M.filter isproposed c) = return lenientRemoteConfigParser
|
||||
| otherwise = case parseRemoteConfig c lenientRemoteConfigParser of
|
||||
Left _ -> return lenientRemoteConfigParser
|
||||
Right pc -> case (getRemoteConfigValue externaltypeField pc, getRemoteConfigValue readonlyField pc) of
|
||||
|
@ -826,3 +829,6 @@ remoteConfigParser c
|
|||
(Just externaltype, _) -> do
|
||||
external <- newExternal externaltype Nothing pc Nothing Nothing
|
||||
strictRemoteConfigParser external
|
||||
where
|
||||
isproposed (Accepted _) = False
|
||||
isproposed (Proposed _) = True
|
||||
|
|
Loading…
Reference in a new issue