diff options
Diffstat (limited to 'plugins/memory')
-rw-r--r-- | plugins/memory/memoryjobs/consumer.go | 4 | ||||
-rw-r--r-- | plugins/memory/memorykv/kv.go | 4 | ||||
-rw-r--r-- | plugins/memory/memorypubsub/pubsub.go | 2 | ||||
-rw-r--r-- | plugins/memory/plugin.go | 2 |
4 files changed, 10 insertions, 2 deletions
diff --git a/plugins/memory/memoryjobs/consumer.go b/plugins/memory/memoryjobs/consumer.go index dacc2848..79246063 100644 --- a/plugins/memory/memoryjobs/consumer.go +++ b/plugins/memory/memoryjobs/consumer.go @@ -61,6 +61,10 @@ func NewJobBroker(configKey string, log logger.Logger, cfg config.Configurer, eh return nil, errors.E(op, err) } + if jb.cfg == nil { + return nil, errors.E(op, errors.Errorf("config not found by provided key: %s", configKey)) + } + if jb.cfg.Prefetch == 0 { jb.cfg.Prefetch = 100_000 } diff --git a/plugins/memory/memorykv/kv.go b/plugins/memory/memorykv/kv.go index 9b3e176c..5383275c 100644 --- a/plugins/memory/memorykv/kv.go +++ b/plugins/memory/memorykv/kv.go @@ -33,6 +33,10 @@ func NewInMemoryDriver(key string, log logger.Logger, cfgPlugin config.Configure return nil, errors.E(op, err) } + if d.cfg == nil { + return nil, errors.E(op, errors.Errorf("config not found by provided key: %s", key)) + } + d.cfg.InitDefaults() go d.gc() diff --git a/plugins/memory/memorypubsub/pubsub.go b/plugins/memory/memorypubsub/pubsub.go index 75122571..231da134 100644 --- a/plugins/memory/memorypubsub/pubsub.go +++ b/plugins/memory/memorypubsub/pubsub.go @@ -21,7 +21,7 @@ type PubSubDriver struct { func NewPubSubDriver(log logger.Logger, _ string) (*PubSubDriver, error) { ps := &PubSubDriver{ - pushCh: make(chan *pubsub.Message, 10), + pushCh: make(chan *pubsub.Message, 100), storage: bst.NewBST(), log: log, } diff --git a/plugins/memory/plugin.go b/plugins/memory/plugin.go index 515e469a..87e0f84b 100644 --- a/plugins/memory/plugin.go +++ b/plugins/memory/plugin.go @@ -49,7 +49,7 @@ func (p *Plugin) PSConstruct(key string) (pubsub.PubSub, error) { } func (p *Plugin) KVConstruct(key string) (kv.Storage, error) { - const op = errors.Op("inmemory_plugin_provide") + const op = errors.Op("memory_plugin_construct") st, err := memorykv.NewInMemoryDriver(key, p.log, p.cfg) if err != nil { return nil, errors.E(op, err) |