darkskyapp / node-sarra

consume data from Environment and Climate Change Canada
13 stars 3 forks source link

Queue Expiry #5

Closed ghost closed 7 years ago

ghost commented 7 years ago

Right now, we fiddle with durability and autoDelete to determine how long a queue should stick around. This is messy and can lead to impolite behavior, where a client creates a durable queue that never gets deleted. The client should force any queues it creates to expire after a given period of time, like an hour, in order to cover for short-term disconnects.

node-amqp doesn't seem to have a manual setting for this... is it maybe something we need to pass in the arguments of .queue?

ghost commented 7 years ago

Tagging @petersilva

ghost commented 7 years ago

Looks like this can be set by simply adding a x-expires argument to the queue. Easy enough...

ghost commented 7 years ago

I added this in 0.0.5, with a default expiry of three hours. I believe that it only gets used when amqp_durable is set to true: otherwise, the queue will disappear the moment the last client disconnects.