2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 19:04:20 +00:00

98_update.pm: deny duplicate executions (Forum #68313)

git-svn-id: https://svn.fhem.de/fhem/trunk@13612 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-03-05 17:48:27 +00:00
parent 45e22fa235
commit e578ad5d8e

View File

@ -27,6 +27,7 @@ my $mainPgm = "/fhem.pl\$";
my %upd_connecthash;
my $upd_needJoin;
my $upd_nChanged;
my $upd_running;
########################################
@ -69,14 +70,18 @@ CommandUpdate($$)
$updateInBackground = AttrVal("global","updateInBackground",1);
$updateInBackground = 0 if($arg ne "all");
$updArg = $arg;
return "An update is already running" if($upd_running);
$upd_running = 1;
if($updateInBackground) {
CallFn($cl->{NAME}, "ActivateInformFn", $cl, "log");
BlockingCall("doUpdateInBackground", {src=>$src,arg=>$arg});
sub updDone(@) { $upd_running=0 }
BlockingCall("doUpdateInBackground", {src=>$src,arg=>$arg}, "updDone");
return "Executing the update the background.";
} else {
doUpdateLoop($src, $arg);
my $ret = $updRet; $updRet = "";
$upd_running = 0;
return $ret;
}