batched ota restore

@czue 

Initial testing is positive. For my test user with 11000 cases the memory comparison is:
* old: 2165808 kb
* new: 1553736 kb
F401 'get_db' imported but unused