add debugging of opening and closing connections to proxies

This commit is contained in:
Joey Hess 2024-07-29 09:48:06 -04:00
parent 7ac8d36f38
commit c8e7231f48
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 16 additions and 7 deletions

View file

@ -539,13 +539,20 @@ instance Show ProxyConnection where
openedProxyConnection openedProxyConnection
:: UUID :: UUID
-> String
-> Proxy.ProxySelector -> Proxy.ProxySelector
-> Annex () -> Annex ()
-> Proxy.ConcurrencyConfig -> Proxy.ConcurrencyConfig
-> IO ProxyConnection -> Annex ProxyConnection
openedProxyConnection u selector closer concurrency = do openedProxyConnection u desc selector closer concurrency = do
now <- getPOSIXTime now <- liftIO getPOSIXTime
return $ ProxyConnection u selector closer concurrency now fastDebug "P2P.Http" ("Opened proxy connection to " ++ desc)
return $ ProxyConnection u selector closer' concurrency now
where
closer' = do
fastDebug "P2P.Http" ("Closing proxy connection to " ++ desc)
closer
fastDebug "P2P.Http" ("Closed proxy connection to " ++ desc)
openProxyConnectionToRemote openProxyConnectionToRemote
:: AnnexWorkerPool :: AnnexWorkerPool
@ -557,7 +564,8 @@ openProxyConnectionToRemote workerpool clientmaxversion bypass remote =
inAnnexWorker' workerpool $ do inAnnexWorker' workerpool $ do
remoteside <- proxyRemoteSide clientmaxversion bypass remote remoteside <- proxyRemoteSide clientmaxversion bypass remote
concurrencyconfig <- Proxy.noConcurrencyConfig concurrencyconfig <- Proxy.noConcurrencyConfig
liftIO $ openedProxyConnection (Remote.uuid remote) openedProxyConnection (Remote.uuid remote)
("remote " ++ Remote.name remote)
(Proxy.singleProxySelector remoteside) (Proxy.singleProxySelector remoteside)
(Proxy.closeRemoteSide remoteside) (Proxy.closeRemoteSide remoteside)
concurrencyconfig concurrencyconfig
@ -576,7 +584,8 @@ openProxyConnectionToCluster workerpool clientmaxversion bypass clusteruuid conc
(proxyselector, closenodes) <- (proxyselector, closenodes) <-
clusterProxySelector clusteruuid clientmaxversion bypass clusterProxySelector clusteruuid clientmaxversion bypass
concurrencyconfig <- Proxy.mkConcurrencyConfig concurrency concurrencyconfig <- Proxy.mkConcurrencyConfig concurrency
liftIO $ openedProxyConnection (fromClusterUUID clusteruuid) openedProxyConnection (fromClusterUUID clusteruuid)
("cluster " ++ fromUUID (fromClusterUUID clusteruuid))
proxyselector closenodes concurrencyconfig proxyselector closenodes concurrencyconfig
type ProxyConnectionPool = (Integer, M.Map ProxyConnectionPoolKey [ProxyConnection]) type ProxyConnectionPool = (Integer, M.Map ProxyConnectionPoolKey [ProxyConnection])

View file

@ -32,7 +32,7 @@ Planned schedule of work:
over http leaves open the connection to the cluster, so the next request over http leaves open the connection to the cluster, so the next request
opens another one. opens another one.
So does an interrupted PUT directly to the proxied ; So does an interrupted PUT directly to the proxied
special remote over http. special remote over http.
* When part of a file has been sent to a cluster via the http server, * When part of a file has been sent to a cluster via the http server,