Files
mongo/buildscripts/resmokelib/utils/sharded_cluster_util.py
Abdul Qadeer 19c2fe5e4c SERVER-99922 Add missing time import (#31654)
GitOrigin-RevId: a3a47d3e8f673401fadacc5f81ec9f24a6a8148a
2025-01-28 16:49:22 +00:00

19 lines
604 B
Python

import time
import pymongo.errors
def refresh_logical_session_cache_with_retry(mongo_client):
retry_count = 10
while retry_count > 0:
try:
mongo_client.admin.command({"refreshLogicalSessionCacheNow": 1})
break
except pymongo.errors.OperationFailure as err:
if err.code == 70: # ShardNotFound
time.sleep(0.5) # Wait a little bit before trying again.
retry_count -= 1
raise err
if retry_count == 0:
raise Exception("Unable to refresh the logical session cache for the config server.")