Skip to content

Commit 294df0e

Browse files
fix: remove invalid aclose() calls on AsyncIterator
1 parent fc8f9c1 commit 294df0e

2 files changed

Lines changed: 0 additions & 18 deletions

File tree

examples/utils/streaming_classify_utils.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,10 @@ async def classify_images(
132132
received_count,
133133
error_count,
134134
)
135-
# Close async generator to terminate stream
136-
await results.aclose()
137135
break
138136

139137
except Exception:
140138
logger.exception("Error during classification")
141-
# Always close the stream on error to prevent hanging
142-
await results.aclose()
143139
if received_count == 0:
144140
raise
145141
finally:
@@ -221,15 +217,10 @@ async def classify_images_break_on_first_result(
221217
)
222218

223219
error_count = process_errors(logger, result, error_count)
224-
225-
# Explicitly close the async generator to terminate the stream
226-
await results.aclose()
227220
break
228221

229222
except Exception:
230223
logger.exception("Error during classification")
231-
# Always close the stream on error to prevent hanging
232-
await results.aclose()
233224
if received_count == 0:
234225
raise
235226

tests/utils/streaming_classify_utils.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,10 @@ async def classify_images(
127127
received_count,
128128
error_count,
129129
)
130-
# Close async generator to terminate stream
131-
await results.aclose()
132130
break
133131

134132
except Exception:
135133
logger.exception("Error during classification")
136-
# Always close the stream on error to prevent hanging
137-
await results.aclose()
138134
if received_count == 0:
139135
raise
140136
finally:
@@ -214,15 +210,10 @@ async def classify_images_break_on_first_result(
214210
)
215211

216212
error_count = process_errors(logger, result, error_count)
217-
218-
# Explicitly close the async generator to terminate the stream
219-
await results.aclose()
220213
break
221214

222215
except Exception:
223216
logger.exception("Error during classification")
224-
# Always close the stream on error to prevent hanging
225-
await results.aclose()
226217
if received_count == 0:
227218
raise
228219

0 commit comments

Comments
 (0)