Skip to content

Commit

Permalink
Only writing state if Looped data source used
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis-chambers committed Jul 2, 2024
1 parent 1c17d3a commit 84bb6b8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/iotswarm/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 84bb6b8

Please sign in to comment.