Erlang: Adding psubscribe support to eredis
Well it may not seem like much but today I had my first pull request accepted on GitHub. I really needed pattern subscribe in the eredis driver. Although support for publish and subscribe had already been added, this didn’t include support for pattern subscribe. I guess while the pub/sub pattern is pretty common, not as many people need to be able to pattern match on many different channels at once.
I am really grateful for the existing pub/sub support though as this was in fact what I needed initially. It was only later when I discovered some cool stuff I could do with pattern subscribe that I looked for information on how to use it - and of course found it wasn’t there.
I was able to take the existing code and from that add in support for pattern subscribe. I certainly could not have written it from scratch myself but by using the rest of the code as a template, I was able to come up with a working solution.
I tidied up the code and made a pull request, but the author (quite rightly - and politely) asked me to add some tests. I’d never really written formal tests in Erlang but I was keen to share my code so I learned how to write the tests.
And so, after writing the tests, the author kindly accepted my patch. So now my little change will have a lot more impact. Anyone who wants to use eredis with pattern subscribe can now do so.
So while it is just another day for those guys who put in all the effort on huge projects, for me it’s something pretty special. I definitely look forward to contributing more actively in the future!
For those interested in the link itself (you can see what happens when I try to write tests at 3am) check out https://github.com/wooga/eredis/pull/26#issuecomment-5148823
blog comments powered by Disqus