Metrics compacting segfault

* do not find metrics to delete by $in ids, ids are known upfront
* lock cron when doing crontab.flush