From 221152406b0352240b2afae8b5db93c1946b35d1 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Fri, 20 Oct 2017 20:59:52 +0000 Subject: [PATCH] 93_DbLog: V2.22.13, output of reopen command improved git-svn-id: https://svn.fhem.de/fhem/trunk@15297 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/93_DbLog.pm | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index adf67865e..edd724ca6 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - change: 93_DbLog: V2.22.13, output of reopen command improved - bugfix: 93_DbLog: V2.22.12, avoid illegible messages in "state" - feature: 59_WUup: add set-command "update" - bugfix: 46_TeslaPowerwall2AC: fix get data internal timer bug diff --git a/fhem/FHEM/93_DbLog.pm b/fhem/FHEM/93_DbLog.pm index 365d0fae0..894545148 100644 --- a/fhem/FHEM/93_DbLog.pm +++ b/fhem/FHEM/93_DbLog.pm @@ -16,6 +16,7 @@ ############################################################################################################################################ # Versions History done by DS_Starter & DeeSPe: # +# 2.22.13 20.10.2017 output of reopen command improved # 2.22.12 19.10.2017 avoid illegible messages in "state" # 2.22.11 13.10.2017 DbLogType expanded by SampleFill, DbLog_sampleDataFn adapted to sort case insensitive, commandref revised # 2.22.10 04.10.2017 Encode::encode_utf8 of $error, DbLog_PushAsyncAborted adapted to use abortArg (Forum:77472) @@ -156,7 +157,7 @@ use Blocking; use Time::HiRes qw(gettimeofday tv_interval); use Encode qw(encode_utf8); -my $DbLogVersion = "2.22.12"; +my $DbLogVersion = "2.22.13"; my %columns = ("DEVICE" => 64, "TYPE" => 64, @@ -503,7 +504,7 @@ sub DbLog_Set($@) { } else { unless ($a[2] =~ /^[0-9]+$/) { return " The Value of $a[1]-time is not valid. Use only figures 0-9 !";} # Statusbit "Kein Schreiben in DB erlauben" wenn reopen mit Zeitangabe - $hash->{HELPER}{REOPEN_RUNS} = 1; + $hash->{HELPER}{REOPEN_RUNS} = $a[2]; # falls ein hängender Prozess vorhanden ist -> löschen BlockingKill($hash->{HELPER}{RUNNING_PID}) if($hash->{HELPER}{RUNNING_PID}); @@ -515,8 +516,9 @@ sub DbLog_Set($@) { delete $hash->{HELPER}{DELDAYS_PID}; delete $hash->{HELPER}{REDUCELOG_PID}; - Log3($name, 3, "DbLog $name: Connection closed. Reopen requested in $a[2] seconds."); - readingsSingleUpdate($hash, "state", "closed for $a[2] seconds", 1); + my $ts = (split(" ",FmtDateTime(gettimeofday()+$a[2])))[1]; + Log3($name, 2, "DbLog $name: Connection closed until $ts ($a[2] seconds)."); + readingsSingleUpdate($hash, "state", "closed until $ts ($a[2] seconds)", 1); InternalTimer(gettimeofday()+$a[2], "reopen", $hash, 0); } } @@ -4400,14 +4402,14 @@ return; sub reopen ($){ my ($hash) = @_; my $name = $hash->{NAME}; - my $async = AttrVal($name, "asyncMode", undef); + my $async = AttrVal($name, "asyncMode", undef); RemoveInternalTimer($hash, "reopen"); if(DbLog_ConnectPush($hash)) { # Statusbit "Kein Schreiben in DB erlauben" löschen - delete $hash->{HELPER}{REOPEN_RUNS}; - Log3($name, 3, "DbLog $name: Database connection reopen request finished."); + my $delay = delete $hash->{HELPER}{REOPEN_RUNS}; + Log3($name, 2, "DbLog $name: Database connection reopened (it was $delay seconds closed)."); readingsSingleUpdate($hash, "state", "reopened", 1); DbLog_execmemcache($hash) if($async); } else {