Skip to content

Commit

Permalink
Move poll time out of updater.
Browse files Browse the repository at this point in the history
  • Loading branch information
UpstreamData committed Jul 30, 2024
1 parent 36b6153 commit 752990d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions goosebit/updater/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class HandlingType(StrEnum):
class UpdateManager(ABC):
def __init__(self, dev_id: str):
self.dev_id = dev_id
self.poll_time = POLL_TIME

async def get_device(self) -> Device | None:
return
Expand Down Expand Up @@ -101,6 +100,14 @@ def update_complete(self):
def update_complete(self, value: bool):
device_update_status[self.dev_id] = value

@property
def poll_time(self):
return device_poll_time.get(self.dev_id, POLL_TIME)

@poll_time.setter
def poll_time(self, value: str):
device_poll_time[self.dev_id] = value

async def publish_log(self, log_data: str | None):
for cb in self.log_subscribers:
await cb(log_data)
Expand Down Expand Up @@ -293,9 +300,10 @@ async def clear_log(self) -> None:
await self.publish_log(None)


device_managers = {"unknown": UnknownUpdateManager("unknown")}
device_log_subscriptions: dict[str, list[Callable]] = {}
device_update_status: dict[str, bool] = {}
device_poll_time: dict[str, str] = {}
device_managers = {"unknown": UnknownUpdateManager("unknown")}


async def get_update_manager(dev_id: str) -> UpdateManager:
Expand Down

0 comments on commit 752990d

Please sign in to comment.