Redundant Drive Detail Calls #15

Open
opened 2026-02-02 14:49:05 -05:00 by jared · 0 comments
Owner

_get_drive_details() is called multiple times for the same drive:

Line 1207 in ticket creation

Line 1418 in SMART check

Line 1286 in firmware check

Cache the results:

def init(self, ...):
# ...
self._drive_details_cache = {} # Add cache

def _get_drive_details(self, device: str) -> Dict[str, str]:
"""Get detailed drive information using smartctl (cached)."""
if device in self._drive_details_cache:
return self._drive_details_cache[device]

drive_details = {  # ... existing code ...  }

# Cache the result
self._drive_details_cache[device] = drive_details
return drive_details
_get_drive_details() is called multiple times for the same drive: Line 1207 in ticket creation Line 1418 in SMART check Line 1286 in firmware check Cache the results: def __init__(self, ...): # ... self._drive_details_cache = {} # Add cache def _get_drive_details(self, device: str) -> Dict[str, str]: """Get detailed drive information using smartctl (cached).""" if device in self._drive_details_cache: return self._drive_details_cache[device] drive_details = { # ... existing code ... } # Cache the result self._drive_details_cache[device] = drive_details return drive_details
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/hwmonDaemon#15