Skip to content

Commit

Permalink
Merge pull request #959 from mrakitin/wait-for-connection-timeout-set…
Browse files Browse the repository at this point in the history
…ting

Properly propagate connection_timeout from .set_defaults()
  • Loading branch information
danielballan authored Jan 15, 2021
2 parents ed6ecb9 + 7bcd868 commit 03585f0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ophyd/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,8 +1061,10 @@ def _ensure_connected(self, *pvs, timeout):
raise TimeoutError(f'Control layer {self.cl.name} failed to send connection and '
f'access rights information within {float(timeout):.1f} sec')

def wait_for_connection(self, timeout=1.0):
def wait_for_connection(self, timeout=DEFAULT_CONNECTION_TIMEOUT):
'''Wait for the underlying signals to initialize or connect'''
if timeout is DEFAULT_CONNECTION_TIMEOUT:
timeout = self.connection_timeout
try:
self._ensure_connected(self._read_pv, timeout=timeout)
except TimeoutError:
Expand Down Expand Up @@ -1485,8 +1487,10 @@ def subscribe(self, callback, event_type=None, run=True):

return super().subscribe(callback, event_type=event_type, run=run)

def wait_for_connection(self, timeout=1.0):
def wait_for_connection(self, timeout=DEFAULT_CONNECTION_TIMEOUT):
'''Wait for the underlying signals to initialize or connect'''
if timeout is DEFAULT_CONNECTION_TIMEOUT:
timeout = self.connection_timeout
self._ensure_connected(self._read_pv, self._write_pv, timeout=timeout)

@property
Expand Down

0 comments on commit 03585f0

Please sign in to comment.