Skip to content

Commit fa027c7

Browse files
committed
Revert "target: poll needed resources only when activating"
This reverts commit d81eb86. The change could cause inconsistent driver states (e.g. drivers active for resources that have become unavailable), as not all resources are processed by update_resources. See the original PR #1638 for more details. Signed-off-by: Jan Luebbe <[email protected]>
1 parent 4cbe4bc commit fa027c7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

labgrid/target.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ def interact(self, msg):
4141
else:
4242
input(msg)
4343

44-
def update_resources(self, resources=None):
44+
def update_resources(self):
4545
"""
4646
Iterate over all relevant resources and deactivate any active but
4747
unavailable resources.
4848
"""
4949
if (monotonic() - self.last_update) < 0.1:
5050
return
5151
self.last_update = monotonic()
52-
for resource in self.resources if resources is None else resources:
52+
for resource in self.resources:
5353
resource.poll()
5454
if not resource.avail and resource.state is BindingState.active:
5555
deactivated = self.deactivate(resource)
@@ -71,7 +71,7 @@ def await_resources(self, resources, timeout=None, avail=True):
7171
timeout (float): optional timeout
7272
avail (bool): optionally wait until the resources are unavailable with avail=False
7373
"""
74-
self.update_resources(resources)
74+
self.update_resources()
7575

7676
waiting = set(r for r in resources if r.avail != avail)
7777
static = set(r for r in waiting if r.get_managed_parent() is None)
@@ -102,7 +102,7 @@ def await_resources(self, resources, timeout=None, avail=True):
102102
filter=waiting
103103
)
104104

105-
self.update_resources(resources)
105+
self.update_resources()
106106

107107
def get_resource(self, cls, *, name=None, wait_avail=True):
108108
"""

0 commit comments

Comments
 (0)