Skip to content

Commit c4fdcfb

Browse files
committed
Update pylint workflow to trigger on pull requests and refactor SoriaInverterDevice timeout handling
1 parent d6ff63a commit c4fdcfb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.github/workflows/pylint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Pylint
22

3-
on: [push]
3+
on: [push, pull_request]
44

55
jobs:
66
build:

tinytuya/Contrib/SoriaInverterDevice.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,12 @@ def receive_and_update(self, timeout=1):
144144
145145
Returns the raw tinytuya message dict, or None.
146146
"""
147-
data = self.receive(timeout=timeout)
147+
old_timeout = self.connection_timeout
148+
self.set_socketTimeout(timeout)
149+
try:
150+
data = self.receive()
151+
finally:
152+
self.set_socketTimeout(old_timeout)
148153
if data and 'dps' in data:
149154
self._cached_dps.update(data['dps'])
150155
for dp_id in [DPS_FULL, DPS_REALTIME, DPS_EVENT, DPS_STATUS, DPS_RAW]:

0 commit comments

Comments
 (0)