yuce / teacup_nats

Teacup based NATS client for Erlang
Apache License 2.0
17 stars 9 forks source link

Cleanup subscription maps on unsubscribe #10

Closed mceaglens closed 7 years ago

mceaglens commented 7 years ago

Hi again,

Added some clean-up of the subscription maps to avoid them to grow for ever. I had problem how to handle if max_messages was used in unsub, but we do not use that so I appreciate if this also could be merged. Maybe you have ideas for max_messages?

Also added a disconnect test for my earlier commit.

mceaglens commented 7 years ago

Any comments?

yuce commented 7 years ago

Sorry for the late response and thanks for your contribution. Would it be possible for you to add a test for it?

mceaglens commented 7 years ago

I don't see an obvious way to test the internal content of the map (the commit solves a memory leak in the case we do a lot of sub,unsub on the same subject from different pids). Would it be enough to just make sure that repeated sub, unsub,sub, unsub still works, that is we have not destroyed the use case where we earlier reused the same key in the maps?

yuce commented 7 years ago

OK, merging this. Thank you for your contribution.