bang: throttle retries
commit6ddbb9e1ac16ff0a9ec09018af0fe4887d879000
authorKyle J. McKay <mackyle@gmail.com>
Wed, 31 Aug 2016 16:57:43 +0000 (31 09:57 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Wed, 31 Aug 2016 16:57:43 +0000 (31 09:57 -0700)
treeffdab40b24fb6e64f96d8b8ad3b030811caf666e
parenta036cd633ba29d203d85c775a409987bb980aad2
bang: throttle retries

When a mirror becomes "banged", it does not wait until the next
$Girocco::Config::min_mirror_interval before trying again, rather it may
try again as early as the jobd.pl restart delay between queue runs
(which defaults to 300 seconds).

While this retry behavior seems appropriate for brief transient failures
allowing the mirror to start updating again almost immediately after
service is restored, it does not work so well for lasting outages of a
mirror source as we keep banging away on the non-working mirror trying
to get an update.

Instead, after an initial period of rapid retries (subject only to the
jobd.pl restart delay) after a mirror update failure, back off and only
retry the mirror once every min_mirror_interval so that we do not
unnecessarily waste resources trying to restart updates for a mirror
whose source is apparently suffering from a long-lasting outage.

This reduces the impact on the rest of the mirrors and still the broken
mirror will get updated within one min_mirror_interval after it starts
working again.

We accomplish this feat by updating the gitweb.lastrefresh timestamp but
NOT the modification date of the .last_refresh file.  Since gitweb only
looks at the last modification timestamp on the .last_refresh file when
displaying the summary page, the summary page will continue to show the
date of the last successful refresh even after we have updated the
gitweb.lastrefresh timestamp in order to throttle back on unnecessary
retries for a failed mirror.

And since update.sh and jobd.pl only look at the gitweb.lastrefresh
timestamp they will properly throttle back on updates for failed
mirrors.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
jobd/update.sh
shlib.sh