diff --git a/magnet/electrode.py b/magnet/electrode.py index 65276c4..62f7826 100644 --- a/magnet/electrode.py +++ b/magnet/electrode.py @@ -37,7 +37,7 @@ async def auto(self): self.reso = field.Resonator(f"{self.config['NATS_USER']}:{self.config['NATS_PASSWORD']}@{self.config['NATS_URL']}") self.embedder = memory.Embedder(self.config, create=self.config["CREATE"]) await self.reso.on(category=self.config['NATS_CATEGORY'], session=self.config['NATS_SESSION'], stream=self.config['NATS_STREAM']) - await self.reso.listen(cb=self.embedder.index, job_range=self.config['JOB_RANGE']) # this will not work yet due to being a list of items, not one at a time + await self.reso.listen(cb=self.embedder.index, job_range=self.config['JOB_RANGE']) diff --git a/magnet/ic/field.py b/magnet/ic/field.py index b455ed5..7fb1c5d 100644 --- a/magnet/ic/field.py +++ b/magnet/ic/field.py @@ -221,7 +221,8 @@ async def listen(self, cb=print, job_range: tuple = None): msgs = self.sub.fetch(job_range[1])[job_range[0], job_range[1]] payloads = [Payload(**json.loads(msg.data)) for msg in msgs] try: - await cb(payloads, msgs) + for payload, msg in payloads, msgs: + await cb(payload, msg) except Exception as e: _f('fatal', e) except Exception as e: