public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: STABLE3 - cman init: faster stop operation
@ 2009-04-24 4:25 Fabio M. Di Nitto
0 siblings, 0 replies; only message in thread
From: Fabio M. Di Nitto @ 2009-04-24 4:25 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=202410c294867474201f85be11eab3f579801088
Commit: 202410c294867474201f85be11eab3f579801088
Parent: bc0a0bb15ea60dafd331c301344335354f819301
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate: Fri Apr 24 06:23:14 2009 +0200
Committer: Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Fri Apr 24 06:23:14 2009 +0200
cman init: faster stop operation
stop daemon operation was waiting for one sec in between
each check, before going forward. This was a bit too much.
On distributions that have a sleep that supports decimal
operations, switch to 250ms instead of 1 second.
This makes the stop operation a lot faster (in the normal
case).
Tested by David Teigland.
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
cman/init.d/cman.in | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
index 49df088..3ba6c15 100644
--- a/cman/init.d/cman.in
+++ b/cman/init.d/cman.in
@@ -202,20 +202,34 @@ start_daemon()
errmsg=$( $daemon $args 2>&1 )
}
+check_sleep()
+{
+ if ! sleep 0.01 > /dev/null 2>&1; then
+ return 1
+ fi
+}
+
stop_daemon()
{
daemon=$1
shift
- maxretries=$1
+ retryforsec=$1
- [ -z "$maxretries" ] && maxretries=1
+ [ -z "$retryforsec" ] && retryforsec=1
retries=0
+ if check_sleep; then
+ sleepfor=0.25
+ retryforsec=$(($retryforsec * 4))
+ else
+ sleepfor=1
+ fi
+
while status $daemon > /dev/null 2>&1 && \
- [ $retries -lt $maxretries ]; do
+ [ $retries -lt $retryforsec ]; do
errmsg=$( pkill -TERM $daemon ) || return 1
- sleep 1
+ sleep $sleepfor
((retries++))
done
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-24 4:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-24 4:25 cluster: STABLE3 - cman init: faster stop operation Fabio M. Di Nitto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).