put db access to background

Also synchronize initAppraiseTask to avoid data races.