Fix crash.

Fixes a crash where after a few hours, the DB connection will timeout, causing the next request to fail catastrophically.