public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: "Fabio M. Di Nitto" <fabbione@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: cluster: STABLE3 - cman init: faster stop operation Date: Fri, 24 Apr 2009 04:25:00 -0000 [thread overview] Message-ID: <20090424042526.C4BFC1201FE@lists.fedorahosted.org> (raw) 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
reply other threads:[~2009-04-24 4:25 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090424042526.C4BFC1201FE@lists.fedorahosted.org \ --to=fabbione@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).