diff options
author | Valery Piashchynski <[email protected]> | 2021-06-01 14:57:33 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-06-01 14:57:33 +0300 |
commit | 352b0f7cfcc1beaeb4d66777f30732f4003ce6d2 (patch) | |
tree | d940de0ee304d3edb60daa35568c3f186dc6a8b5 /plugins/memory | |
parent | 548ee4432e48b316ada00feec1a6b89e67ae4f2f (diff) |
- Initial commit
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/memory')
-rw-r--r-- | plugins/memory/plugin.go | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/plugins/memory/plugin.go b/plugins/memory/plugin.go index 49c187bc..b9c5933a 100644 --- a/plugins/memory/plugin.go +++ b/plugins/memory/plugin.go @@ -15,14 +15,14 @@ type Plugin struct { log logger.Logger // channel with the messages from the RPC - pushCh chan *pubsub.Message + pushCh chan []byte // user-subscribed topics topics sync.Map } func (p *Plugin) Init(log logger.Logger) error { p.log = log - p.pushCh = make(chan *pubsub.Message, 100) + p.pushCh = make(chan []byte, 100) return nil } @@ -34,18 +34,14 @@ func (p *Plugin) Name() string { return PluginName } -func (p *Plugin) Publish(messages []*pubsub.Message) error { - for i := 0; i < len(messages); i++ { - p.pushCh <- messages[i] - } +func (p *Plugin) Publish(messages []byte) error { + p.pushCh <- messages return nil } -func (p *Plugin) PublishAsync(messages []*pubsub.Message) { +func (p *Plugin) PublishAsync(messages []byte) { go func() { - for i := 0; i < len(messages); i++ { - p.pushCh <- messages[i] - } + p.pushCh <- messages }() } |