Skip to content

Commit

Permalink
wow what an annoying bug
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Nov 28, 2023
1 parent 5242e0f commit ed3a0cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions pioreactor/actions/led_intensity.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ def led_intensity(
# any locked channels?
for channel in list(desired_state.keys()):
if is_led_channel_locked(channel):
updated_successfully = False
logger.debug(
f"Unable to update channel {channel} due to a software lock on it. Please try again."
)
del desired_state[channel]
desired_state = {k: v for k, v in desired_state.items() if k != channel}

updated_successfully = False

for channel, intensity in desired_state.items():
try:
Expand Down
6 changes: 4 additions & 2 deletions pioreactor/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
from pioreactor.pubsub import subscribe_and_callback


def boolean_retry(function: Callable, f_args, max_attempts: int = 3, sleep_for=0.25) -> bool:
def boolean_retry(
func: Callable[..., bool], f_args: tuple, max_attempts: int = 3, sleep_for: float = 0.25
) -> bool:
for _ in range(max_attempts):
res = function(*f_args)
res = func(*f_args)
if res:
return res
time.sleep(sleep_for)
Expand Down

0 comments on commit ed3a0cf

Please sign in to comment.