avoid double-connect to unreachable ssh remote
When git-annex-shell p2pstdio fails with 255, it's because the ssh server is not reachable. Avoid running the fallback action in this case, since it would just try a second time to connect, and presumably fail. Note that the closed P2PSshConnection will not be stored in the pool, so the next request tries again to connect. This is just the right behavior; when the remote becomes reachable again, the same git-annex process will start using it. This commit was sponsored by Ole-Morten Duesund on Patreon.
This commit is contained in:
parent
e36ceb7448
commit
c3df5d1f10
6 changed files with 43 additions and 37 deletions
|
@ -342,7 +342,7 @@ inAnnex rmt (State connpool duc) key
|
|||
)
|
||||
checkremote =
|
||||
let fallback = Ssh.inAnnex r key
|
||||
in P2PHelper.checkpresent (Ssh.runProto rmt connpool fallback) key
|
||||
in P2PHelper.checkpresent (Ssh.runProto rmt connpool (cantCheck rmt) fallback) key
|
||||
checklocal = ifM duc
|
||||
( guardUsable r (cantCheck r) $
|
||||
maybe (cantCheck r) return
|
||||
|
@ -384,7 +384,7 @@ dropKey r (State connpool duc) key
|
|||
| Git.repoIsHttp (repo r) = giveup "dropping from http remote not supported"
|
||||
| otherwise = commitOnCleanup r $ do
|
||||
let fallback = Ssh.dropKey (repo r) key
|
||||
P2PHelper.remove (Ssh.runProto r connpool fallback) key
|
||||
P2PHelper.remove (Ssh.runProto r connpool False fallback) key
|
||||
|
||||
lockKey :: Remote -> State -> Key -> (VerifiedCopy -> Annex r) -> Annex r
|
||||
lockKey r (State connpool duc) key callback
|
||||
|
@ -471,7 +471,7 @@ copyFromRemote' forcersync r (State connpool _) key file dest meterupdate
|
|||
| Git.repoIsSsh (repo r) = if forcersync
|
||||
then unVerified fallback
|
||||
else P2PHelper.retrieve
|
||||
(Ssh.runProto r connpool fallback)
|
||||
(Ssh.runProto r connpool False fallback)
|
||||
key file dest meterupdate
|
||||
| otherwise = giveup "copying from non-ssh, non-http remote not supported"
|
||||
where
|
||||
|
@ -572,7 +572,7 @@ copyToRemote r (State connpool duc) key file meterupdate
|
|||
)
|
||||
| Git.repoIsSsh (repo r) = commitOnCleanup r $
|
||||
P2PHelper.store
|
||||
(Ssh.runProto r connpool copyremotefallback)
|
||||
(Ssh.runProto r connpool False copyremotefallback)
|
||||
key file meterupdate
|
||||
|
||||
| otherwise = giveup "copying to non-ssh repo not supported"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue