forked from platypush/platypush
Prevent RuntimeError on lock release if lock acquisition failed
This commit is contained in:
parent
3b8c580611
commit
5cfbd75250
1 changed files with 8 additions and 2 deletions
|
@ -110,7 +110,10 @@ class SerialPlugin(GpioSensorPlugin):
|
|||
else:
|
||||
data = self.last_measurement
|
||||
finally:
|
||||
try:
|
||||
self.serial_lock.release()
|
||||
except:
|
||||
pass
|
||||
|
||||
if data:
|
||||
self.last_measurement = data
|
||||
|
@ -143,7 +146,10 @@ class SerialPlugin(GpioSensorPlugin):
|
|||
self.logger.info('Writing {} to {}'.format(data, self.device))
|
||||
ser.write(data)
|
||||
finally:
|
||||
try:
|
||||
self.serial_lock.release()
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
# vim:sw=4:ts=4:et:
|
||||
|
|
Loading…
Reference in a new issue