save a reference to created tasks, to avoid tasks disappearing mid-execution

This commit is contained in:
ali 2023-06-28 18:34:59 +02:00
parent eb5da9511e
commit d559b46cf6
4 changed files with 7 additions and 7 deletions

View file

@ -43,7 +43,7 @@ class DiskSpaceManager:
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 = []

View file

@ -1383,7 +1383,7 @@ class Daemon(metaclass=JSONRPCServerType):
])
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)
@ -2001,7 +2001,7 @@ class Daemon(metaclass=JSONRPCServerType):
])
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

View file

@ -334,7 +334,7 @@ class Ledger(metaclass=LedgerRegistry):
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())

View file

@ -170,7 +170,7 @@ class TestComponentManagerProperStart(AdvanceTimeTestCase):
)
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)
@ -188,7 +188,7 @@ class TestComponentManagerProperStart(AdvanceTimeTestCase):
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)
@ -196,7 +196,7 @@ class TestComponentManagerProperStart(AdvanceTimeTestCase):
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)