From 8564b44f7352eeeb1ab11244915e5c2eaf46a8ec Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Sun, 16 Jan 2022 16:45:33 +0000 Subject: [PATCH] 93_DbRep: contrib v 8.47.0 git-svn-id: https://svn.fhem.de/fhem/trunk@25475 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/93_DbRep.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fhem/contrib/DS_Starter/93_DbRep.pm b/fhem/contrib/DS_Starter/93_DbRep.pm index 78b45aaaf..85c9cd19d 100644 --- a/fhem/contrib/DS_Starter/93_DbRep.pm +++ b/fhem/contrib/DS_Starter/93_DbRep.pm @@ -11421,19 +11421,29 @@ sub DbRep_initSQLcmdCache { my $name = shift; my $hash = $defs{$name}; + RemoveInternalTimer ($name, "DbRep_initSQLcmdCache"); + if (!$init_done) { + InternalTimer(time+1, "DbRep_initSQLcmdCache", $name, 0); + return; + } + $data{DbRep}{$name}{sqlcache}{index} = 0; # SQL-CommandHistory CacheIndex my ($err,$hl) = DbRep_getCmdFile($name."_sqlCmdList"); if($hl) { $hl = (split ":", $hl, 2)[1]; - Log3 ($name, 4, "DbRep $name - history sql commandlist read from file ".$attr{global}{modpath}."/FHEM/FhemUtils/cacheDbRep"); - my @cmds = split ",", $hl; + my @cmds = split ",", $hl; + my $count = 0; + for my $elem (@cmds) { $elem = _DbRep_deconvertSQL ($elem); _DbRep_insertSQLtoCache ($name, $elem); + $count++; } + + Log3 ($name, 4, qq{DbRep $name - SQL history restored from Cache file - count: "$count"}) if($count); } return;