Move DB init into worker thread