From 7c2f2ecb39910d7a260be2834351462724503abb Mon Sep 17 00:00:00 2001 From: "Matthew D. Scholefield" Date: Thu, 22 Mar 2018 13:50:18 -0500 Subject: [PATCH] Fix msm lock hanging forever Sometimes the send_end_update would happen before the send_start_update and due to the install_started being false, msm.updated would never get sent --- msm/msm | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/msm/msm b/msm/msm index 6dd8a155f8..a6c6f25842 100755 --- a/msm/msm +++ b/msm/msm @@ -130,10 +130,7 @@ function send_start_install () { fi } function send_start_update () { - if [[ "${update_started}" == "false" ]] ; then - python -m mycroft.messagebus.send msm.updating - update_started="true" - fi + python -m mycroft.messagebus.send msm.updating } function send_start_remove () { if [[ "${remove_started}" == "false" ]] ; then @@ -159,9 +156,7 @@ function send_end_install () { fi } function send_end_update () { - if [[ "${update_started}" == "true" ]] ; then - python -m mycroft.messagebus.send msm.updated - fi + python -m mycroft.messagebus.send msm.updated } function send_end_remove () { if [[ "${remove_started}" == "true" ]] ; then @@ -531,8 +526,8 @@ function update() { echo "Updating installed skills..." cd "${mycroft_skill_folder}" - send_start_update & - pids=("$!") + send_start_update + pids=() # Loop through all of the current Skill folders for d in $(find "${mycroft_skill_folder}" -mindepth 1 -maxdepth 1 -type d |grep -v '.git'$ ); do @@ -543,7 +538,9 @@ function update() { pids+=("$!") fi done - wait $pids + for pid in "${pids[@]}"; do + wait $pid + done # TODO: Remove this for 18.02 # HACK: Only do the re-PIP once per boot @@ -740,7 +737,7 @@ case ${OPT} in fi # Create .msm file to provide timestamp for last msm default - rm ${mycroft_skill_folder}/.msm + rm -f ${mycroft_skill_folder}/.msm printf "" > ${mycroft_skill_folder}/.msm.tmp # These skills are automatically installed on all mycroft-core # installations.