Skip to content
This repository was archived by the owner on Feb 26, 2026. It is now read-only.

Commit fe6044c

Browse files
committed
add list_buckets threshold
1 parent 8e36f87 commit fe6044c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

samples/snippets/export_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
# old sink, in seconds
3535
CLEANUP_THRESHOLD = 7200 # 2 hours
3636

37+
# Max buckets to delete at a time, to mitigate operation timeout
38+
# issues. To turn off in the future, set to None.
39+
MAX_BUCKETS = 1500
40+
3741

3842
def _random_id():
3943
return "".join(
@@ -69,7 +73,7 @@ def cleanup_old_sinks():
6973
# See _sink_storage_setup in usage_guide.py for details about how
7074
# sinks are named.
7175
test_bucket_name_regex = r"^sink\-storage\-(\d+)$"
72-
for bucket in storage_client.list_buckets():
76+
for bucket in storage_client.list_buckets(max_results=MAX_BUCKETS):
7377
match = re.match(test_bucket_name_regex, bucket.name)
7478
if match:
7579
# Bucket timestamp is int(time.time() * 1000)

0 commit comments

Comments
 (0)