nmhive.py: Use per-request database connections.
On #notmuch, Austin Clements just said:
Opening the database always gives you a consistent snapshot, so you
won't see changes unless you close and reopen it. However, opening
in read-only mode is quite cheap.
so I'm going to drop my global connection in favor of per-request
connections. This also allows me to cleanup after aborted atomic
transactions (when I implement the POST backend), because notmuch does
not currently expose Xapian::WritableDatabase::cancel_transaction. It
also allows other readers to see the new data, since notmuch only
commits changes when the database connection is closed. Finally,
David Bremner pointed out that holding the read/write lock for an
extended period of time is just bad form.