From 84bb6b8715191bb92e0615484925d6f2ad60c24f Mon Sep 17 00:00:00 2001 From: Lewis Chambers Date: Tue, 2 Jul 2024 11:18:23 +0100 Subject: [PATCH] Only writing state if Looped data source used --- src/iotswarm/devices.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/iotswarm/devices.py b/src/iotswarm/devices.py index 8f7cb51..9c6a112 100644 --- a/src/iotswarm/devices.py +++ b/src/iotswarm/devices.py @@ -4,7 +4,14 @@ import logging from iotswarm import __version__ as package_version from iotswarm.queries import CosmosTable -from iotswarm.db import BaseDatabase, CosmosDB, Oracle, LoopingCsvDB, LoopingSQLite3 +from iotswarm.db import ( + BaseDatabase, + MockDB, + CosmosDB, + Oracle, + LoopingCsvDB, + LoopingSQLite3, +) from iotswarm.messaging.core import MessagingBaseClass, MockMessageConnection from iotswarm.messaging.aws import IotCoreMQTTConnection from typing import List @@ -306,7 +313,9 @@ async def run(self): ) self.cycle += 1 - if isinstance(self.data_source, (LoopingCsvDB, LoopingSQLite3)): + if isinstance( + self.data_source, (LoopingCsvDB, LoopingSQLite3, MockDB) + ): if self.swarm is not None: self.swarm.write_self(replace=True) else: