fix disabled methods after autodetector
This commit is contained in:
@@ -65,4 +65,8 @@ interface CallMethods {
|
||||
* Returns list of methods conforming the methods group
|
||||
*/
|
||||
fun getGroupMethods(groupName: String): Set<String>
|
||||
|
||||
fun getDisabledMethods(): Set<String> {
|
||||
return setOf()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,9 @@ class ManagedCallMethods(
|
||||
private val allAllowed: Set<String> = Collections.unmodifiableSet(
|
||||
delegated.keys + allGroupEnabled - allGroupDisabled.toSet() + enabled - disabled,
|
||||
)
|
||||
private val allDisabled: Set<String> = Collections.unmodifiableSet(
|
||||
allGroupDisabled.toSet() + disabled
|
||||
)
|
||||
private val quorum: MutableMap<String, Factory<CallQuorum>> = HashMap()
|
||||
private val staticResponse: MutableMap<String, String> = HashMap()
|
||||
|
||||
@@ -101,6 +104,10 @@ class ManagedCallMethods(
|
||||
return allAllowed
|
||||
}
|
||||
|
||||
override fun getDisabledMethods(): Set<String> {
|
||||
return allDisabled
|
||||
}
|
||||
|
||||
override fun isHardcoded(method: String): Boolean {
|
||||
return this.staticResponse.containsKey(method) || delegate.isHardcoded(method)
|
||||
}
|
||||
|
||||
@@ -296,6 +296,7 @@ open class GenericUpstream(
|
||||
if (config.methods == null) {
|
||||
config.methods = UpstreamsConfig.Methods(mutableSetOf(), mutableSetOf())
|
||||
}
|
||||
val allDisabled = getMethods().getDisabledMethods()
|
||||
val enableMethods =
|
||||
rpcDetector
|
||||
.filter { (_, enabled) -> enabled }
|
||||
@@ -312,6 +313,7 @@ open class GenericUpstream(
|
||||
UpstreamsConfig.Methods(
|
||||
enableMethods
|
||||
.minus(disableMethods)
|
||||
.filter { !allDisabled.contains(it.name) }.toSet()
|
||||
.plus(config.methods!!.enabled),
|
||||
disableMethods
|
||||
.minus(enableMethods)
|
||||
|
||||
Reference in New Issue
Block a user