Commit 66ebb5f8 authored by ZZH's avatar ZZH

opt 2026-6-25 15:57

parent 1a2725f7
......@@ -126,17 +126,12 @@ class Meter3rdForward:
async def snapshot_sampler(self):
while not self.stop_event.is_set():
try:
# sec_to_min = 60 - (time.time() % 60) + 5
# await asyncio.sleep(sec_to_min)
if not self.d_last_msg:
continue
cur_batch = dict(self.d_last_msg)
self.d_last_msg.clear()
for fid, raw_msg in cur_batch.items():
if fid in SCADA_FIELDS_MAP:
await self.parse_and_forward(fid, raw_msg)
if self.d_last_msg:
cur_batch = dict(self.d_last_msg)
self.d_last_msg.clear()
for fid, raw_msg in cur_batch.items():
if fid in SCADA_FIELDS_MAP:
await self.parse_and_forward(fid, raw_msg)
await asyncio.sleep(1)
except Exception as e:
......@@ -216,4 +211,4 @@ if __name__ == '__main__':
try:
asyncio.run(main())
except KeyboardInterrupt:
pass
\ No newline at end of file
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment