Skip to content

Commit 54c8d07

Browse files
kien-truongchalmerlowetswast
authored
fix: avoid blocking in download thread when using BQ Storage API (googleapis#2034)
This prevents a deadlock between the main thead and download threads when the threadpool is shutdown prematurely. Co-authored-by: Chalmer Lowe <chalmerlowe@google.com> Co-authored-by: Tim Sweña (Swast) <swast@google.com>
1 parent 3a48948 commit 54c8d07

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

google/cloud/bigquery/_pandas_helpers.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,10 +796,15 @@ def _download_table_bqstorage_stream(
796796
rowstream = reader.rows(session)
797797

798798
for page in rowstream.pages:
799-
if download_state.done:
800-
return
801799
item = page_to_item(page)
802-
worker_queue.put(item)
800+
while True:
801+
if download_state.done:
802+
return
803+
try:
804+
worker_queue.put(item, timeout=_PROGRESS_INTERVAL)
805+
break
806+
except queue.Full: # pragma: NO COVER
807+
continue
803808

804809

805810
def _nowait(futures):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy