Survive postgresql connection losses. Closes #95.