Skip to content

Commit

Permalink
Merge pull request #36 from mthespian/minor_timing_improvements
Browse files Browse the repository at this point in the history
Minor timing improvements
  • Loading branch information
Hundemeier authored Jul 6, 2021
2 parents f94be2d + b4c19d5 commit f031599
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sacn/sending/sender_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def __init__(self, cid: tuple, source_name: str, outputs: Dict[int, Output], bin

def on_periodic_callback(self, current_time: float) -> None:
# send out universe discovery packets if necessary
if abs(current_time - self._last_time_universe_discover) > E131_E131_UNIVERSE_DISCOVERY_INTERVAL \
and self.universe_discovery:
if self.universe_discovery and \
abs(current_time - self._last_time_universe_discover) >= E131_E131_UNIVERSE_DISCOVERY_INTERVAL:
self.send_universe_discovery_packets()
self._last_time_universe_discover = current_time

Expand All @@ -44,8 +44,8 @@ def on_periodic_callback(self, current_time: float) -> None:
[self.send_out(output, current_time) for output in list(self._outputs.values())
# only send if the manual flush feature is disabled
# send out when the 1 second interval is over
if not self.manual_flush and
(abs(current_time - output._last_time_send) > SEND_OUT_INTERVAL or output._changed)]
if not self.manual_flush and \
(output._changed or abs(current_time - output._last_time_send) >= SEND_OUT_INTERVAL)]

def send_out(self, output: Output, current_time: float):
# 1st: Destination (check if multicast)
Expand Down

0 comments on commit f031599

Please sign in to comment.