Add retry mechanism to deal with stale connections in the pool or flacky connection to db