From 7604036dfb45b429d65ea924ad3373f67b15e718 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Mon, 17 Feb 2020 18:49:08 +0000 Subject: [PATCH] fhem.pl: cache the uniqueID (Forum #108512) git-svn-id: https://svn.fhem.de/fhem/trunk@21215 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/fhem.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 8ae5eccd2..7404640c2 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -303,6 +303,7 @@ my @cmdList; # Remaining commands in a chain. Used by sleep my %sleepers; # list of sleepers my %delayedShutdowns; # definitions needing delayed shutdown my %fuuidHash; # for duplicate checking +my $globalUniqueID; # cache it $init_done = 0; $lastDefChange = 0; @@ -5435,13 +5436,18 @@ FileDelete($) sub getUniqueId() { + return $globalUniqueID if($globalUniqueID); my ($err, $uniqueID) = getKeyValue("uniqueID"); if(defined($uniqueID)) { $uniqueID =~ s/[^0-9a-f]//g; - return $uniqueID if($uniqueID && length($uniqueID) == 32); + if($uniqueID && length($uniqueID) == 32) { + $globalUniqueID = $uniqueID; + return $uniqueID; + } } $uniqueID = createUniqueId(); setKeyValue("uniqueID", $uniqueID); + $globalUniqueID = $uniqueID; return $uniqueID; }