@@ -2336,11 +2336,7 @@ def test_watch_document(client, cleanup, database):
23362336 doc_ref .set ({"first" : "Jane" , "last" : "Doe" , "born" : 1900 })
23372337 cleanup (doc_ref .delete )
23382338
2339- # TODO(https://github.com/googleapis/google-cloud-python/issues/17428):
2340- # Investigate why these sleep/polling delays are needed for listener tests.
2341- # Having arbitrary delays is fragile and can lead to flakiness.
2342- # Explore event-driven synchronization.
2343- sleep (0.2 )
2339+ sleep (1 )
23442340
23452341 # Setup listener
23462342 def on_snapshot (docs , changes , read_time ):
@@ -2353,12 +2349,12 @@ def on_snapshot(docs, changes, read_time):
23532349 # Alter document
23542350 doc_ref .set ({"first" : "Ada" , "last" : "Lovelace" , "born" : 1815 })
23552351
2356- sleep (0.2 )
2352+ sleep (1 )
23572353
2358- for _ in range (50 ):
2354+ for _ in range (10 ):
23592355 if on_snapshot .called_count > 0 :
23602356 break
2361- sleep (0.2 )
2357+ sleep (1 )
23622358
23632359 if on_snapshot .called_count not in (1 , 2 ):
23642360 raise AssertionError (
@@ -2388,19 +2384,15 @@ def on_snapshot(docs, changes, read_time):
23882384
23892385 collection_ref .on_snapshot (on_snapshot )
23902386
2391- # TODO(https://github.com/googleapis/google-cloud-python/issues/17428):
2392- # Investigate why these sleep/polling delays are needed for listener tests.
2393- # Having arbitrary delays is fragile and can lead to flakiness.
2394- # Explore event-driven synchronization.
23952387 # delay here so initial on_snapshot occurs and isn't combined with set
2396- sleep (0.2 )
2388+ sleep (1 )
23972389
23982390 doc_ref .set ({"first" : "Ada" , "last" : "Lovelace" , "born" : 1815 })
23992391
2400- for _ in range (50 ):
2392+ for _ in range (10 ):
24012393 if on_snapshot .born == 1815 :
24022394 break
2403- sleep (0.2 )
2395+ sleep (1 )
24042396
24052397 if on_snapshot .born != 1815 :
24062398 raise AssertionError (
@@ -2419,11 +2411,7 @@ def test_watch_query(client, cleanup, database):
24192411 doc_ref .set ({"first" : "Jane" , "last" : "Doe" , "born" : 1900 })
24202412 cleanup (doc_ref .delete )
24212413
2422- # TODO(https://github.com/googleapis/google-cloud-python/issues/17428):
2423- # Investigate why these sleep/polling delays are needed for listener tests.
2424- # Having arbitrary delays is fragile and can lead to flakiness.
2425- # Explore event-driven synchronization.
2426- sleep (0.2 )
2414+ sleep (1 )
24272415
24282416 # Setup listener
24292417 def on_snapshot (docs , changes , read_time ):
@@ -2441,10 +2429,10 @@ def on_snapshot(docs, changes, read_time):
24412429 # Alter document
24422430 doc_ref .set ({"first" : "Ada" , "last" : "Lovelace" , "born" : 1815 })
24432431
2444- for _ in range (50 ):
2432+ for _ in range (10 ):
24452433 if on_snapshot .called_count == 1 :
24462434 return
2447- sleep (0.2 )
2435+ sleep (1 )
24482436
24492437 if on_snapshot .called_count != 1 :
24502438 raise AssertionError (
@@ -2818,11 +2806,7 @@ def on_snapshot(docs, changes, read_time):
28182806 on_snapshot .failed = None
28192807 query_ref .on_snapshot (on_snapshot )
28202808
2821- # TODO(https://github.com/googleapis/google-cloud-python/issues/17428):
2822- # Investigate why these sleep/polling delays are needed for listener tests.
2823- # Having arbitrary delays is fragile and can lead to flakiness.
2824- # Explore event-driven synchronization.
2825- sleep (0.2 )
2809+ sleep (1 )
28262810
28272811 doc_ref1 .set ({"first" : "Ada" , "last" : "Lovelace" , "born" : 1815 })
28282812 cleanup (doc_ref1 .delete )
@@ -2839,10 +2823,10 @@ def on_snapshot(docs, changes, read_time):
28392823 doc_ref5 .set ({"first" : "Ada" , "last" : "lovelace" , "born" : 1815 })
28402824 cleanup (doc_ref5 .delete )
28412825
2842- for _ in range (50 ):
2826+ for _ in range (10 ):
28432827 if on_snapshot .last_doc_count == 5 :
28442828 break
2845- sleep (0.2 )
2829+ sleep (1 )
28462830
28472831 if on_snapshot .failed :
28482832 raise on_snapshot .failed
0 commit comments