-
Notifications
You must be signed in to change notification settings - Fork 241
Closed
Labels
Description
Describe the bug
Attaching a dynamic node to a dataflow seems duplicate dora timers. In this example, a dynamic node uses a dora timer at 1Hz. Each time it reconnects to the dataflow, it receives messages at an additional 1Hz. This issue is not limited to the dynamic node that is joining the system. I noticed this issue while debugging why a non-dynamic node was receiving timer messages at 10X the expected frequency.
To Reproduce
Steps to reproduce the behavior:
- Dora start daemon:
dora up - Start this dataflow:
nodes:
- id: listener
path: dynamic
inputs:
tick: dora/timer/millis/1000
- Run this dynamic node in a different terminal window:
import numpy as np
import typer
import time
from dora import Node
def main() -> None:
dora_node = Node("listener")
for i in range(10):
event = dora_node.next()
if event is None:
continue
if event["type"] == "INPUT" and event["id"] == "tick":
print(time.time())
exit(0)
if __name__ == "__main__":
main()
- Wait 10s for the node to exit. Notice that it prints ~1 timestamp per second (which matches the specified delivery rate of the timer)
- Run the node again. Wait 10s. Notice that it now receives ~2 messages / s. Repeat as many times as you want -- the rate should increase by ~1Hz each run.
Here is the outcome from one run of this experiment:
(ultra) ➜ robot-teleop git:(main) ✗ python dora/nodes/debug/listener.py
1758824727.956637
1758824728.880161
1758824729.88055
1758824730.881057
1758824731.880955
1758824732.880385
1758824733.880681
1758824734.8809211
1758824735.880395
1758824736.881108
(ultra) ➜ robot-teleop git:(main) ✗ python dora/nodes/debug/listener.py
1758824738.054562
1758824738.880747
1758824739.030727
1758824739.880241
1758824740.031757
1758824740.8804522
1758824741.0320761
1758824741.8806798
1758824742.030806
1758824742.880495
(ultra) ➜ robot-teleop git:(main) ✗ python dora/nodes/debug/listener.py
1758824748.819641
1758824748.880179
1758824749.031594
1758824749.797119
1758824749.8810282
1758824750.031374
1758824750.797981
1758824750.880852
1758824751.031512
1758824751.798072
Expected behavior
The node should always receive messages from this timer at 1 Hz.
Environments (please complete the following information):
- System info: Mac OS, Ubuntu 24.04
- Dora version: 0.3.9 and 0.3.12