Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4a609a4

Browse filesBrowse files
authored
fix: close write object stream always (#1661)
fix: close write object stream always. otherwise Task will remain for long time until GC kills it and it'll throw this `"Task was destroyed but it is pending!"`
1 parent de2c8e9 commit 4a609a4
Copy full SHA for 4a609a4

File tree

Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed
Open diff view settings
Collapse file

‎google/cloud/storage/_experimental/asyncio/async_appendable_object_writer.py‎

Copy file name to clipboardExpand all lines: google/cloud/storage/_experimental/asyncio/async_appendable_object_writer.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ async def close(self, finalize_on_close=False) -> Union[int, _storage_v2.Object]
267267
await self.finalize()
268268
else:
269269
await self.flush()
270-
await self.write_obj_stream.close()
270+
271+
await self.write_obj_stream.close()
271272

272273
self._is_stream_open = False
273274
self.offset = None
Collapse file

‎tests/unit/asyncio/test_async_appendable_object_writer.py‎

Copy file name to clipboardExpand all lines: tests/unit/asyncio/test_async_appendable_object_writer.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ async def test_finalize_on_close(mock_write_object_stream, mock_client):
313313
result = await writer.close(finalize_on_close=True)
314314

315315
# Assert
316-
mock_stream.close.assert_not_awaited() # Based on new implementation
316+
mock_stream.close.assert_awaited_once()
317317
assert not writer._is_stream_open
318318
assert writer.offset is None
319319
assert writer.object_resource == mock_resource

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.