File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ Revision history for GLPI agent
22
331.13 not yet released
44
5+ inventory:
6+ * On windows, don't cache system is not 64 bits for the service lifetime as this can
7+ be the result of a failed WMI call at the service start.
8+
59netdiscovery/netinventory:
610* PR #836 from @eduardomozart: Enhanced HP wireless printers by reporting wifi ports
711 as wireless
Original file line number Diff line number Diff line change @@ -76,10 +76,18 @@ our @EXPORT = qw(
7676) ;
7777
7878my $_is64bits = undef ;
79+ my $_is64bits_expiration;
80+ my $_is64bits_nextcheck = 1;
7981sub is64bit {
8082 # Cache is64bit() result in a private module variable to avoid a lot of wmi
8183 # calls and as this value won't change during the service/task lifetime
82- return $_is64bits if defined ($_is64bits);
84+ # Anyway we make the cached value expirable if we didn't detected it as 64bits
85+ # and in the case WMI request failed. This guaranty to retry the request and not
86+ # cache a wrong value for the service lifetime in some rare cases.
87+ return $_is64bits if $_is64bits ||
88+ ($_is64bits_expiration && time < $_is64bits_expiration);
89+ $_is64bits_expiration = time + $_is64bits_nextcheck;
90+ $_is64bits_nextcheck = $_is64bits_nextcheck >= 2000 ? 3600 : $_is64bits_nextcheck * 2;
8391 return $_is64bits =
8492 any { $_ -> {AddressWidth } eq 64 }
8593 getWMIObjects(
You can’t perform that action at this time.
0 commit comments