Remove extra query for database subscribers

Save a roundtrip to the database to get all database subscribers, including
wildcards. Also factor out duplicated block that processes the subscribers.
Merge pull request #4 from aaronroyer/reduce-queries-for-database-subscribers

Remove extra query for database subscribers