2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 20:24:36 +00:00

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
This commit is contained in:
nasseeder1 2017-10-20 20:59:52 +00:00
parent 76b734ff50
commit 221152406b
2 changed files with 10 additions and 7 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # 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. # 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" - bugfix: 93_DbLog: V2.22.12, avoid illegible messages in "state"
- feature: 59_WUup: add set-command "update" - feature: 59_WUup: add set-command "update"
- bugfix: 46_TeslaPowerwall2AC: fix get data internal timer bug - bugfix: 46_TeslaPowerwall2AC: fix get data internal timer bug

View File

@ -16,6 +16,7 @@
############################################################################################################################################ ############################################################################################################################################
# Versions History done by DS_Starter & DeeSPe: # 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.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.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) # 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 Time::HiRes qw(gettimeofday tv_interval);
use Encode qw(encode_utf8); use Encode qw(encode_utf8);
my $DbLogVersion = "2.22.12"; my $DbLogVersion = "2.22.13";
my %columns = ("DEVICE" => 64, my %columns = ("DEVICE" => 64,
"TYPE" => 64, "TYPE" => 64,
@ -503,7 +504,7 @@ sub DbLog_Set($@) {
} else { } else {
unless ($a[2] =~ /^[0-9]+$/) { return " The Value of $a[1]-time is not valid. Use only figures 0-9 !";} 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 # 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 # falls ein hängender Prozess vorhanden ist -> löschen
BlockingKill($hash->{HELPER}{RUNNING_PID}) if($hash->{HELPER}{RUNNING_PID}); 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}{DELDAYS_PID};
delete $hash->{HELPER}{REDUCELOG_PID}; delete $hash->{HELPER}{REDUCELOG_PID};
Log3($name, 3, "DbLog $name: Connection closed. Reopen requested in $a[2] seconds."); my $ts = (split(" ",FmtDateTime(gettimeofday()+$a[2])))[1];
readingsSingleUpdate($hash, "state", "closed for $a[2] seconds", 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); InternalTimer(gettimeofday()+$a[2], "reopen", $hash, 0);
} }
} }
@ -4400,14 +4402,14 @@ return;
sub reopen ($){ sub reopen ($){
my ($hash) = @_; my ($hash) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $async = AttrVal($name, "asyncMode", undef); my $async = AttrVal($name, "asyncMode", undef);
RemoveInternalTimer($hash, "reopen"); RemoveInternalTimer($hash, "reopen");
if(DbLog_ConnectPush($hash)) { if(DbLog_ConnectPush($hash)) {
# Statusbit "Kein Schreiben in DB erlauben" löschen # Statusbit "Kein Schreiben in DB erlauben" löschen
delete $hash->{HELPER}{REOPEN_RUNS}; my $delay = delete $hash->{HELPER}{REOPEN_RUNS};
Log3($name, 3, "DbLog $name: Database connection reopen request finished."); Log3($name, 2, "DbLog $name: Database connection reopened (it was $delay seconds closed).");
readingsSingleUpdate($hash, "state", "reopened", 1); readingsSingleUpdate($hash, "state", "reopened", 1);
DbLog_execmemcache($hash) if($async); DbLog_execmemcache($hash) if($async);
} else { } else {