Move nsql publishing to its own thread.

Publishing was hanging the main lua update thread.