From 8b8b04c428856d527884eb12f6a3fd380c377ec3 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 15 Nov 2013 10:07:11 +0100 Subject: [PATCH] MT#4999 Avoid re-execution of ngcp-check_active Running ngcp-check_active for each single script causes quite some overhead, it should be enough to just check for result of ngcp-check_active *once* and then re-use the result. --- ngcp-update-db-schema | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ngcp-update-db-schema b/ngcp-update-db-schema index 029342f1..9ccf7461 100755 --- a/ngcp-update-db-schema +++ b/ngcp-update-db-schema @@ -83,6 +83,12 @@ running_on_active_node() { fi } +if running_on_active_node ; then + ACTIVE_NODE=true +else + ACTIVE_NODE=false +fi + apply_revision() { [ -n "$1" ] || return 1 @@ -174,7 +180,7 @@ revision_wrapper() { revlist="$revlist $(basename $rev)" ;; *) - if running_on_active_node ; then + if $ACTIVE_NODE ; then echo "Replication script ${revname} noted, nothing to do on active node" else revlist="$revlist $(basename $rev)"