Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

save a reference to created tasks, to avoid tasks disappearing #3734

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lbry/blob/disk_space_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async def _clean(self, is_network_blob=False):
space_used_mb = space_used_mb['content_storage'] + space_used_mb['private_storage']
storage_limit_mb = self.config.network_storage_limit if is_network_blob else self.config.blob_storage_limit
if self.analytics:
asyncio.create_task(
task = asyncio.create_task(
self.analytics.send_disk_space_used(space_used_mb, storage_limit_mb, is_network_blob)
)
delete = []
Expand Down
4 changes: 2 additions & 2 deletions lbry/extras/daemon/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ async def jsonrpc_wallet_import(self, data, password=None, wallet_id=None, block
])
else:
for new_account in added_accounts:
asyncio.create_task(self.ledger.subscribe_account(new_account))
task = asyncio.create_task(self.ledger.subscribe_account(new_account))
wallet.save()
return await self.jsonrpc_wallet_export(password=password, wallet_id=wallet_id)

Expand Down Expand Up @@ -2001,7 +2001,7 @@ async def jsonrpc_sync_apply(self, password, data=None, wallet_id=None, blocking
])
else:
for new_account in added_accounts:
asyncio.create_task(self.ledger.subscribe_account(new_account))
task = asyncio.create_task(self.ledger.subscribe_account(new_account))
wallet_changed = True
if wallet.preferences.get(ENCRYPT_ON_DISK, False) and password != wallet.encryption_password:
wallet.encryption_password = password
Expand Down
2 changes: 1 addition & 1 deletion lbry/wallet/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ async def start(self):
self.headers.open()
]))
fully_synced = self.on_ready.first
asyncio.create_task(self.network.start())
task = asyncio.create_task(self.network.start())
await self.network.on_connected.first
async with self._header_processing_lock:
await self._update_tasks.add(self.initial_headers_sync())
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/components/test_component_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def setUp(self):
)

async def test_proper_starting_of_components(self):
asyncio.create_task(self.component_manager.start())
task = asyncio.create_task(self.component_manager.start())

await self.advance(0)
self.assertTrue(self.component_manager.get_component('wallet').running)
Expand All @@ -188,15 +188,15 @@ async def test_proper_starting_of_components(self):
self.assertTrue(self.component_manager.get_component('file_manager').running)

async def test_proper_stopping_of_components(self):
asyncio.create_task(self.component_manager.start())
task = asyncio.create_task(self.component_manager.start())
await self.advance(0)
await self.advance(1)
await self.advance(1)
self.assertTrue(self.component_manager.get_component('wallet').running)
self.assertTrue(self.component_manager.get_component('blob_manager').running)
self.assertTrue(self.component_manager.get_component('file_manager').running)

asyncio.create_task(self.component_manager.stop())
task = asyncio.create_task(self.component_manager.stop())
await self.advance(0)
self.assertFalse(self.component_manager.get_component('file_manager').running)
self.assertTrue(self.component_manager.get_component('blob_manager').running)
Expand Down