put a try/except around all mongo calls in periodic_ops