diff options
author | Bharath Vignesh J K <52282402+RazCrimson@users.noreply.github.com> | 2024-05-14 01:14:21 +0530 |
---|---|---|
committer | Bharath Vignesh J K <52282402+RazCrimson@users.noreply.github.com> | 2024-05-14 01:46:39 +0530 |
commit | 84a511c7162f19275d48444888ca075ce7603095 (patch) | |
tree | 54e1be0811cdc690fc920bb2eb38ba57734610a9 | |
parent | 714d252999a93e54481a2d3f619d0742542545e6 (diff) |
hotfix: plugin(sensors) - race conditions btw fan_speed & temperature methods
(cherry-picked for v4.0.2 from latest develop `8c1b7499`)
-rw-r--r-- | glances/plugins/sensors/__init__.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/glances/plugins/sensors/__init__.py b/glances/plugins/sensors/__init__.py index 0ed9341a..0173235a 100644 --- a/glances/plugins/sensors/__init__.py +++ b/glances/plugins/sensors/__init__.py @@ -87,7 +87,9 @@ class PluginModel(GlancesPluginModel): # Init the sensor class start_duration.reset() - self.glances_grab_sensors = GlancesGrabSensors() + # Hotfix! Refactor to use only one `GlancesGrabSensors` later + self.glances_grab_sensors_fan_speed = GlancesGrabSensors() + self.glances_grab_sensors_temperature = GlancesGrabSensors() logger.debug("Generic sensor plugin init duration: {} seconds".format(start_duration.get())) # Instance for the HDDTemp Plugin in order to display the hard disks @@ -115,7 +117,7 @@ class PluginModel(GlancesPluginModel): def __get_temperature(self, stats, index): try: - temperature = self.__set_type(self.glances_grab_sensors.get(SENSOR_TEMP_TYPE), SENSOR_TEMP_TYPE) + temperature = self.__set_type(self.glances_grab_sensors_temperature.get(SENSOR_TEMP_TYPE), SENSOR_TEMP_TYPE) except Exception as e: logger.error("Cannot grab sensors temperatures (%s)" % e) else: @@ -123,7 +125,7 @@ class PluginModel(GlancesPluginModel): def __get_fan_speed(self, stats, index): try: - fan_speed = self.__set_type(self.glances_grab_sensors.get(SENSOR_FAN_TYPE), SENSOR_FAN_TYPE) + fan_speed = self.__set_type(self.glances_grab_sensors_fan_speed.get(SENSOR_FAN_TYPE), SENSOR_FAN_TYPE) except Exception as e: logger.error("Cannot grab FAN speed (%s)" % e) else: |