hardbyte / hardbyte/python-can

Implement a configurable rate limit

Aperta
#2,048 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Python
Stelle
1.6k
Fork
697
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I am using python-can (more specifically canopen) to send out messages to a bunch or nodes.

Issues seem to arise when I send a lot of packets at the same time, my assumption is that the recipients can not keep up with the frame stream, and thus packets are dropped.

My Idea is to implement some sort of rate limiting, for example by passing messages to a queue and having the library send out all queued messages with an interval inbetween.

Something like
```
queue = queue.Queue()

while True:
msg = queue.get() # blocking
transmit(msg)
time.sleep(1 / self.max_messages_per_second)
```

Cheers!

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.