-
Notifications
You must be signed in to change notification settings - Fork 294
Config based routing #850
Config based routing #850
Conversation
// bail to prevent deadlock. | ||
if to.(*pool) == p { | ||
return []subscription{} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the reason to remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change should not be removed. Thanks for noticing!
e2291cf
to
4f7ed67
Compare
@@ -227,6 +230,9 @@ func (p *pool) applyPluginMeta(a AvailablePlugin) error { | |||
case plugin.StickyRouting: | |||
p.RoutingAndCaching = NewSticky(cacheTTL) | |||
p.concurrencyCount = 1 | |||
case plugin.ConfigRouting: | |||
p.RoutingAndCaching = NewConfigBased(cacheTTL) | |||
p.concurrencyCount = 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to override the currency count here or allow it to be defined by the plugin author?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I forgot this value can be provided via plugin metadata.
There's one more thing regarding concurrencyCount. I think I found an error in pool.Eligible()
that for p.concurrencyCount != 1
function pool.Eligibility()
does not work properly.
Main condition:
should := p.SubscriptionCount() / p.concurrencyCount
if should > p.Count() && should <= p.max {
return true
}
return false
p.SubscriptionCount()
and p.concurrencyCount
are both int
Let's say p.Count() = 1
, p.max = 3
, p.SubscriptionCount() = 4
and p.concurrencyCount = 3
then should = 1
Main condition is false
, thus pool.Eligible() = false
while in my opinion it should be true
Maybe it should be reimplemented to work on floats?
4d09369
to
204bc40
Compare
Tests fail because of #910 |
2673585
to
04496d4
Compare
"time" | ||
) | ||
|
||
// config-based provides a strategy that ... concurrency count is 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// config-based provides a strategy that selects a plugin based on the given config
Dude, Marcin, I love this! It looks so good. Would you mind adding a test to |
- removed overwritting setting of concurrencyCount to 3 - removed commented code - added case to config based routing unit tests
04496d4
to
f8ff158
Compare
@danielscottt : Thanks! I wrote some additional tests for |
f8ff158
to
4a6fe7f
Compare
LGTM! |
Fixes #539
Summary of changes:
@intelsdi-x/snap-maintainers