gozwave icon indicating copy to clipboard operation
gozwave copied to clipboard

Send queue

Open stamp opened this issue 9 years ago • 1 comments

To be able to read/write information to nodes that are asleep we need to put commands in a send queue. Battery powered devices usually wake up something like each hour and is awake for about 1 second. During this time we need to send all the commands in the queue to that specific node.

There is already a IsAwake() function that returns a blocking channel that can be used to wait for a node to wake up.

An other solution could be to start a go-routine each time we are going to send a message and first call the IsAwake() function. That way the go-routine will wait to send the message until the node is awake.

stamp avatar Dec 22 '16 17:12 stamp

Does order matter here? If not i think the second solution with multiple waiting goroutines is better. But if we need a specific order we should have one goroutine per device with a queue in it.

jonaz avatar Dec 22 '16 21:12 jonaz