rinq / rinq-go

A cross-language command bus and distributed ephemeral data store.
Other
17 stars 1 forks source link

Cleanup unused namespaces. #169

Open jmalloc opened 6 years ago

jmalloc commented 6 years ago

Rinq's public API does not expose a method for cleaning up the underlying resources that are created for a namespace when it is no longer in use. IIRC for the AMQP implementation it is only the namespace-scoped "balanced" command queues that stick around permanently.

~It may be adequate~ It's probably a good idea to issue an AMQP queue.delete with the if-unused and if-empty bits sent when Unlisten() is called or the peer shuts down.

jmalloc commented 6 years ago

I've prototyped the queue.delete in 169-queue-delete, however deleting in this way is racy - a queue.delete issued by one peer may might occur between a queue.declare and a basic.consume of another peer. The tests will probably fail due to this problem.

This could be handled by retrying the queue.declare after basic.consume fails with an AMQP NOT_FOUND exception.

jmalloc commented 6 years ago

/cc @ezzatron, @danilvpetrov