hardbyte / hardbyte/python-can

Implement a configurable rate limit

Đang mở
#2,048 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Python
Star
1.6k
Fork
697
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.