mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-06 23:35:08 +00:00
refactor(plugins): call PluginHealthTracker.record_hang directly
The getattr/callable fallback guarded against a tracker without record_hang, but the core tracker always has it. Clears Codacy's Pylint E1102 (not-callable) false positive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1139,19 +1139,14 @@ class PluginManager:
|
|||||||
err: Exception) -> None:
|
err: Exception) -> None:
|
||||||
"""Record a hang in plugin health: a failure to the circuit breaker.
|
"""Record a hang in plugin health: a failure to the circuit breaker.
|
||||||
|
|
||||||
Goes through PluginHealthTracker.record_hang when the tracker has it
|
PluginHealthTracker.record_hang also counts the hang separately. Never
|
||||||
(it also counts the hang separately), else plain record_failure. Never
|
|
||||||
raises: this runs on the update worker and the render thread.
|
raises: this runs on the update worker and the render thread.
|
||||||
"""
|
"""
|
||||||
tracker = self.health_tracker
|
tracker = self.health_tracker
|
||||||
if tracker is None:
|
if tracker is None:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
record_hang = getattr(tracker, 'record_hang', None)
|
tracker.record_hang(plugin_id, operation, seconds, err)
|
||||||
if callable(record_hang):
|
|
||||||
record_hang(plugin_id, operation, seconds, err)
|
|
||||||
else:
|
|
||||||
tracker.record_failure(plugin_id, err)
|
|
||||||
except Exception as e: # pylint: disable=broad-except
|
except Exception as e: # pylint: disable=broad-except
|
||||||
self.logger.debug("Could not record hang for %s: %s", plugin_id, e)
|
self.logger.debug("Could not record hang for %s: %s", plugin_id, e)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user