robur-coop / builder

Scheduling build jobs on regular intervals, collecting artifacts
ISC License
13 stars 1 forks source link

Queue up observe messages #48

Closed reynir closed 1 month ago

reynir commented 1 month ago

Regular data messages are queued when there are less than 100 messages for that client. Build finish messages are always enqueued. This ensures end messages are never lost, and enhances the user experience for the client as a busy build will drop less messages.

The more function depends on Lwt_condition.signal does not yield so the function doesn't yield before the next Lwt_condition.wait thus more never misses a message.

The number 100 is arbitrary chosen.

I tested on my builder setup, but I don't know how to reproduce missed messages.

hannesm commented 1 month ago

To me this looks fine. I was worried that there may be memory leaked, but the queue is very locally allocated in the client-loop, and thus this should be safe.

I'll merge. We can reconsider if we encounter any issues. Thanks a lot! :)