Events coming from the IoT Box were lost in two cases:
1. Create a listener for device 1
2. Send an action to device 1
--> If the action arrives before the listener the event is never sent
to the DB
1. Setup up two listeners for devices 1 & 2
2. After a few seconds, send two consecutive actions to devices 1 & 2
--> Everytime a longpolling request arrives, a new threading.Event
object is created. The first action sets the event, then, before the
new longpolling request arrives, the second action sets the same event,
which is overwritten once the new longpolling request arrives.
We now maintain a list of events, and when a longpolling request
arrives on the IoT Box, we make sure that all events that occured in
the last 5 seconds were received by the DB. If no events were pending,
we wait 50 seconds to check if a new one pops up.
Taskid: 2320958
X-original-commit: e3260712ce96a8d81bf807574c334d92c37c6ae4