Skip to content

Commit 682d98d

Browse files
authored
Merge pull request #89 from airalab/dev
fix datalog feeder to work with higher frequency
2 parents f456228 + 3cfc5b2 commit 682d98d

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

connectivity/src/feeders/datalog_feeder.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,13 @@ def feed(self, data: tp.List[dict]) -> None:
192192

193193
if (time.time() - self.last_time) >= self.interval:
194194
if self.buffer:
195+
self.last_time = time.time()
195196
logger.debug("Datalog Feeder: About to publish collected data...")
196197
logger.debug(f"Datalog Feeder: Buffer is {self.buffer}")
197198
ipfs_hash, file_path, file_size = _get_multihash(self.buffer, self.db, self.ipfs_endpoint)
198199
self._pin_to_temporal(file_path)
199200
_pin_to_pinata(file_path, self.config)
201+
self.buffer = set()
200202
_upload_to_crust(ipfs_hash, int(file_size), self.config["datalog"]["suri"])
201203
os.unlink(file_path)
202204
self.to_datalog(ipfs_hash)
@@ -240,9 +242,6 @@ def to_datalog(self, ipfs_hash: str) -> None:
240242
:param ipfs_hash: Ipfs hash of the file.
241243
"""
242244

243-
logger.info(ipfs_hash)
244-
self.last_time = time.time()
245-
self.buffer = set()
246245
account = Account(seed=self.config["datalog"]["suri"])
247246
rws = RWS(account)
248247
try:

connectivity/src/stations/httpstation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def do_HEAD(self) -> None:
6262
def do_GET(self) -> None:
6363
"""Callback for get requests."""
6464

65-
logger.info("GET request,\nPath: %s\nHeaders:\n%s\n", str(self.path), str(self.headers))
65+
# logger.info("GET request,\nPath: %s\nHeaders:\n%s\n", str(self.path), str(self.headers))
6666
id = self.headers["Sensor-id"]
6767
self._set_headers(id)
6868
logger.info(f"HTTP Station session length: {len(sessions)}")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "sensors_connectivity"
3-
version = "1.6.2"
3+
version = "1.6.3"
44
description = "Robonomics package to read data from sensors and publish to different output channels"
55
authors = [
66
"Vadim Manaenko <vadim.razorq@gmail.com>",

tests/environmental_box_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def main():
2828
"sensordatavalues": [
2929
{"value_type": "SDS_P1", "value": pm10},
3030
{"value_type": "SDS_P2", "value": pm25},
31+
{"value_type":"DB_Meter","value": 58.00},
3132
{"value_type": "temperature", "value": temperature},
3233
{"value_type": "humidity", "value": humidity},
3334
{"value_type": "samples", "value": "890618"},

0 commit comments

Comments
 (0)