diff options
author | Sitaram Chamarty <sitaram@atc.tcs.com> | 2015-12-15 11:19:12 +0530 |
---|---|---|
committer | Sitaram Chamarty <sitaram@atc.tcs.com> | 2015-12-15 11:37:57 +0530 |
commit | 54ca8f2b8d2d67710cc3583eebff824b45415141 (patch) | |
tree | d679f1e6bc5a5dd94f0df6ec207e7509ac35c224 | |
parent | testing mirror push "one plus one" mode... (read below) (diff) | |
download | gitolite-gentoo-54ca8f2b8d2d67710cc3583eebff824b45415141.tar.gz gitolite-gentoo-54ca8f2b8d2d67710cc3583eebff824b45415141.tar.bz2 gitolite-gentoo-54ca8f2b8d2d67710cc3583eebff824b45415141.zip |
testing mirror push "one plus one" mode... (read below)
Currently, every time someone does a push to a master server, a slave push
(one for each slave) is triggered.
This is not only wasteful, it also causes too much load. First of all, pushes
should be serialised -- there is no point running TWO 'git push --mirror' from
one server to another. This means when one push is running, any more pushes
of the same repo to the same slave must be queued.
But more importantly, it does not make sense to queue more than one!
Hence the "one(running) plus one(queued)" name of the helper script.
-rwxr-xr-x | src/commands/1plus1 | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/commands/1plus1 b/src/commands/1plus1 index 4368103..ef37a24 100755 --- a/src/commands/1plus1 +++ b/src/commands/1plus1 @@ -14,7 +14,7 @@ my @cmd_plus_args = @ARGV; # the actual 'gitolite mirror ...' command open( my $fhrun, ">", "$lockbase.run" ) or die "open '$lockbase.run' failed: $!"; if ( flock( $fhrun, LOCK_EX | LOCK_NB ) ) { - # got run state; you're good to go + # got run lock; you're good to go system(@cmd_plus_args); @@ -26,9 +26,9 @@ if ( flock( $fhrun, LOCK_EX | LOCK_NB ) ) { open( my $fhqueue, ">", "$lockbase.queue" ) or die "open '$lockbase.queue' failed: $!"; if ( flock( $fhqueue, LOCK_EX | LOCK_NB ) ) { - # got queue state, now block waiting for "run" state + # got queue lock, now block waiting for "run" lock flock( $fhrun, LOCK_EX ); - # got run state, so take yourself our of "queue" state, then run + # got run lock, so take yourself out of "queue" state, then run flock( $fhqueue, LOCK_UN ); system(@cmd_plus_args); @@ -38,5 +38,5 @@ if ( flock( $fhqueue, LOCK_EX | LOCK_NB ) ) { } # "queue" lock also failed; someone is running AND someone is queued; we can go home -say STDERR "'$lockbase' already running and 1 in queue"; +say STDERR "INFO: nothing to do/queue; '$lockbase' already running and 1 in queue"; exit 0; |