This repository was archived by the owner on Mar 31, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -699,6 +699,10 @@ def __radd__(self, n):
699699 """
700700 return self .__add__ (n )
701701
702+ def reset (self ):
703+ with self .__lock :
704+ self .__value = 0
705+
702706
703707def _metadata_with_request_id (* args , ** kwargs ):
704708 return with_request_id (* args , ** kwargs )
Original file line number Diff line number Diff line change 7070except ImportError : # pragma: NO COVER
7171 HAS_GOOGLE_CLOUD_MONITORING_INSTALLED = False
7272
73+ from google .cloud .spanner_v1 ._helpers import AtomicCounter
7374
7475_CLIENT_INFO = client_info .ClientInfo (client_library_version = __version__ )
7576EMULATOR_ENV_VAR = "SPANNER_EMULATOR_HOST"
@@ -182,6 +183,8 @@ class Client(ClientWithProject):
182183 SCOPE = (SPANNER_ADMIN_SCOPE ,)
183184 """The scopes required for Google Cloud Spanner."""
184185
186+ NTH_CLIENT = AtomicCounter ()
187+
185188 def __init__ (
186189 self ,
187190 project = None ,
@@ -261,6 +264,12 @@ def __init__(
261264 "default_transaction_options must be an instance of DefaultTransactionOptions"
262265 )
263266 self ._default_transaction_options = default_transaction_options
267+ self ._nth_client_id = Client .NTH_CLIENT .increment ()
268+ self ._nth_request = AtomicCounter (0 )
269+
270+ @property
271+ def _next_nth_request (self ):
272+ return self ._nth_request .increment ()
264273
265274 @property
266275 def credentials (self ):
You can’t perform that action at this time.
0 commit comments