From 5a2423d8577317d99bed9f5a64e2c95269fcdc7e Mon Sep 17 00:00:00 2001 From: Dmitry Kolesnikov Date: Wed, 25 Sep 2024 18:48:13 +0300 Subject: [PATCH] apply bin codec for enqueue messages --- queue/bytes/queue.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/queue/bytes/queue.go b/queue/bytes/queue.go index 11e80c0..f9ba234 100644 --- a/queue/bytes/queue.go +++ b/queue/bytes/queue.go @@ -30,10 +30,15 @@ type queue struct { func (q queue) Put(object []byte) error { return q.Enq(q.cat, object) } func (q queue) Enq(cat string, object []byte) error { + obj, err := q.codec.Encode(object) + if err != nil { + return err + } + ctx := swarm.NewContext(context.Background(), cat, "") - bag := swarm.Bag{Ctx: ctx, Object: object} + bag := swarm.Bag{Ctx: ctx, Object: obj} - err := q.emit.Enq(bag) + err = q.emit.Enq(bag) if err != nil { return err }