pgyori commented on a change in pull request #4748:
URL: https://github.com/apache/nifi/pull/4748#discussion_r565947760
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/bin/nifi.sh
##########
@@ -345,6 +359,31 @@ run() {
if [ "$1" = "start" ]; then
( eval "cd ${NIFI_HOME} && ${run_nifi_cmd}" & )> /dev/null 1>&-
+
+ if [ "$2" = "--wait-for-init" ]; then
+
+ declare -i wait_timeout
+ if is_nonzero_integer "$3" ; then
+ wait_timeout="$3"
+ else
+ wait_timeout=$WAIT_FOR_INIT_DEFAULT_TIMEOUT
+ fi
+
+ declare -i starttime=$(date +%s)
+ declare -i endtime=$starttime+$wait_timeout
+ declare -i current_time
+
+ is_nifi_loaded="false"
+ while [ "$is_nifi_loaded" = "false" ]; do
+ current_time=$(date +%s)
+ if (( current_time >= endtime )); then
+ echo "Exited the script due to --wait-for-init timeout"
+ break;
+ fi
+ is_nifi_loaded=$( eval "cd ${NIFI_HOME} &&
${run_bootstrap_cmd} is_loaded" )
Review comment:
That's a good idea. The $( eval "... is_loaded" ) call also takes a
little time (besides the 2-second sleep), so I introduced a time-based feedback
"mechanism" that will write on the standard output approximately every 10
seconds.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]