2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-09 20:57:11 +00:00

93_DbLog, 93_DbRep: minor fix time until DB is closed

git-svn-id: https://svn.fhem.de/fhem/trunk@17491 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2018-10-08 16:30:49 +00:00
parent 2a2da69bc5
commit 623d675d30
3 changed files with 10 additions and 4 deletions

View File

@ -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, 93_DbRep: minor fix time until DB is closed
- change: 38_netatmo: changed weathermap calls to new endpoints
- feature: 5.9 released

View File

@ -16,6 +16,7 @@
############################################################################################################################################
# Versions History done by DS_Starter & DeeSPe:
#
# 3.12.2 07.10.2018 $hash->{HELPER}{REOPEN_RUNS_UNTIL} contains the time until the DB is closed
# 3.12.1 19.09.2018 use Time::Local (forum:#91285)
# 3.12.0 04.09.2018 corrected SVG-select (https://forum.fhem.de/index.php/topic,65860.msg815640.html#msg815640)
# 3.11.0 02.09.2018 reduceLog, reduceLogNbl - optional "days newer than" part added
@ -210,7 +211,7 @@ use Time::Local;
use Encode qw(encode_utf8);
no if $] >= 5.017011, warnings => 'experimental::smartmatch';
my $DbLogVersion = "3.12.1";
my $DbLogVersion = "3.12.2";
my %columns = ("DEVICE" => 64,
"TYPE" => 64,
@ -588,6 +589,7 @@ sub DbLog_Set($@) {
DbLog_ConnectPush($hash);
if($hash->{HELPER}{REOPEN_RUNS}) {
delete $hash->{HELPER}{REOPEN_RUNS};
delete $hash->{HELPER}{REOPEN_RUNS_UNTIL};
RemoveInternalTimer($hash, "reopen");
}
DbLog_execmemcache($hash) if($async);
@ -610,7 +612,8 @@ sub DbLog_Set($@) {
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], "DbLog_reopen", $hash, 0);
InternalTimer(gettimeofday()+$a[2], "DbLog_reopen", $hash, 0);
$hash->{HELPER}{REOPEN_RUNS_UNTIL} = $ts;
}
}
elsif ($a[1] eq 'rereadcfg') {
@ -4730,6 +4733,7 @@ sub DbLog_reopen ($){
if(DbLog_ConnectPush($hash)) {
# Statusbit "Kein Schreiben in DB erlauben" löschen
my $delay = delete $hash->{HELPER}{REOPEN_RUNS};
delete $hash->{HELPER}{REOPEN_RUNS_UNTIL};
Log3($name, 2, "DbLog $name: Database connection reopened (it was $delay seconds closed).") if($delay);
readingsSingleUpdate($hash, "state", "reopened", 1);
$hash->{HELPER}{OLDSTATE} = "reopened";

View File

@ -42,6 +42,7 @@ use warnings;
# Versions History intern
our %DbRep_vNotesIntern = (
"8.2.1" => "07.10.2018 \$hash->{dbloghash}{HELPER}{REOPEN_RUNS_UNTIL} contains the time until DB is closed ",
"8.2.0" => "05.10.2018 direct help for attributes ",
"8.1.0" => "02.10.2018 new get versionNotes command ",
"8.0.1" => "20.09.2018 DbRep_getMinTs improved",
@ -718,7 +719,7 @@ sub DbRep_Set($@) {
## keine Aktionen außer die über diesem Eintrag solange Reopen xxxx im DbLog-Device läuft
#######################################################################################################
if ($hash->{dbloghash}{HELPER}{REOPEN_RUNS} && $opt !~ /\?/) {
my $ro = (split(" ",FmtDateTime(gettimeofday()+$hash->{dbloghash}{HELPER}{REOPEN_RUNS})))[1];
my $ro = $hash->{dbloghash}{HELPER}{REOPEN_RUNS_UNTIL};
Log3 ($name, 3, "DbRep $name - connection $dblogdevice to db $dbname is closed until $ro - $opt postponed");
ReadingsSingleUpdateValue ($hash, "state", "connection $dblogdevice to $dbname is closed until $ro - $opt postponed", 1);
return;
@ -954,7 +955,7 @@ sub DbRep_Get($@) {
return if(IsDisabled($name));
if ($hash->{dbloghash}{HELPER}{REOPEN_RUNS} && $opt !~ /\?|procinfo|blockinginfo/) {
my $ro = (split(" ",FmtDateTime(gettimeofday()+$hash->{dbloghash}{HELPER}{REOPEN_RUNS})))[1];
my $ro = $hash->{dbloghash}{HELPER}{REOPEN_RUNS_UNTIL};
Log3 ($name, 3, "DbRep $name - connection $dblogdevice to db $dbname is closed until $ro - $opt postponed");
ReadingsSingleUpdateValue ($hash, "state", "connection $dblogdevice to $dbname is closed until $ro - $opt postponed", 1);
return;