From 918d3eb486557edd642c3f8a263a808765b3df2d Mon Sep 17 00:00:00 2001 From: Aaron Bach Date: Thu, 7 Oct 2021 20:59:29 -0600 Subject: [PATCH] Make system update run coroutines in order (and not simultaneously) (#269) --- simplipy/api.py | 1 + simplipy/system/__init__.py | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/simplipy/api.py b/simplipy/api.py index e1382f48..1dcfaa53 100644 --- a/simplipy/api.py +++ b/simplipy/api.py @@ -81,6 +81,7 @@ def __init__( self.request = backoff.on_exception( backoff.expo, ClientResponseError, + jitter=backoff.random_jitter, logger=LOGGER, max_tries=request_retries, on_backoff=self._async_handle_on_backoff, diff --git a/simplipy/system/__init__.py b/simplipy/system/__init__.py index 0d554ca1..584f1982 100644 --- a/simplipy/system/__init__.py +++ b/simplipy/system/__init__.py @@ -1,7 +1,6 @@ """Define V2 and V3 SimpliSafe systems.""" from __future__ import annotations -import asyncio from dataclasses import dataclass from datetime import datetime from enum import Enum @@ -388,14 +387,12 @@ async def async_update( :param cached: Whether to used cached data. :type cached: ``bool`` """ - update_tasks = [] if include_subscription: - update_tasks.append(self._async_update_subscription_data()) + await self._async_update_subscription_data() if include_settings: - update_tasks.append(self._async_update_settings_data(cached)) + await self._async_update_settings_data(cached) if include_devices: - update_tasks.append(self._async_update_device_data(cached)) - await asyncio.gather(*update_tasks) + await self._async_update_device_data(cached) # Create notifications: self._notifications = [