git-annex/Assistant/Types
Joey Hess e5b4d447b6 assistant: Start a new git-annex transferkeys process after a network connection change
So that remotes that use a persistent network connection are restarted.

A remote might keep open a long duration network connection, and could
fail to deal well with losing the connection. This is particularly a
concern now that we have external special reotes. An external
special remote that is implemented naively might open the connection only
when PREPARE is sent, and if it loses connection, throw errors on each
request that is made.

(Note that the ssh connection caching should not have this problem; if the
long-duration ssh process loses connection, the named pipe is disconnected
and the next ssh attempt will reconnect. Also, XMPP already deals with
disconnection robustly in its own way.)

There's no way for git-annex to know if a lost network connection actually
affects a given remote, which might have a transfer in process. It does not
make sense to force kill the transferkeys process every time the NetWatcher
detects a change. (Especially because the NetWatcher sometimes polls 1
change per hour.)

In any case, the NetWatcher only detects connection to a network, not
disconnection. So if a transfer is in progress over the network, and the
network goes down, that will need to time out on its own.

An alternate approch that was considered is to use a separate transferkeys
process for each remote, and detect when a request fails, and assume that
means that process is in a failing state and restart it. The problem with
that approach is that if a resource is not available and a remote fails
every time, it degrades to starting a new transferkeys process for every
file transfer, which is too expensive.

Instead, this commit only handles the network reconnection case, and restarts
transferkeys only once the network has reconnected and another transfer needs
to be made. So, a transferkeys process will be reused for 1 hour, or until the
next network connection.

----

The NotificationBroadcaster was rewritten to use TMVars rather than MSampleVars,
to allow checking without blocking if a notification has been received.

----

This commit was sponsored by Tobias Brunner.
2014-01-06 16:03:39 -04:00
..
Alert.hs better UI flow through upgrade process 2013-11-23 13:27:52 -04:00
BranchChange.hs split BranchChange and lifted 2012-10-29 19:20:54 -04:00
Buddies.hs finished XMPP pairing! 2012-11-05 17:43:17 -04:00
Changes.hs fix bda237f14a 2013-04-24 17:50:11 -04:00
Commits.hs remove last use of TSet 2013-04-24 17:16:04 -04:00
DaemonStatus.hs queue and start download of git-annex from web, using git-annex, when upgrade is started 2013-11-23 17:21:04 -04:00
NamedThread.hs assistant: Detect stale git lock files at startup time, and remove them. 2013-10-05 17:04:21 -04:00
NetMessager.hs fix minor memory leak caused by recent CanPush change 2013-05-22 15:47:06 -04:00
Pushes.hs refactor XMPP client 2012-11-03 14:16:17 -04:00
RepoProblem.hs add post-repair actions 2013-10-29 14:25:20 -04:00
ScanRemotes.hs split cost out into its own module 2013-03-13 16:30:34 -04:00
ThreadedMonad.hs moved ThreadedMonad to Types 2012-10-29 19:07:10 -04:00
ThreadName.hs webapp: Now allows restarting any threads that crash. 2013-01-26 17:09:33 +11:00
TransferQueue.hs moved AssociatedFile definition 2013-07-04 02:36:02 -04:00
TransferrerPool.hs assistant: Start a new git-annex transferkeys process after a network connection change 2014-01-06 16:03:39 -04:00
TransferSlots.hs pushed Assistant monad down into DaemonStatus code 2012-10-30 15:39:15 -04:00
UrlRenderer.hs clean up urlrenderer handling when the webapp is not built 2013-04-03 17:48:54 -04:00