Retry the query few times before giving up.