fix disabled methods after autodetector

This commit is contained in:
Termina1
2025-11-12 20:02:19 +02:00
parent 1381400a98
commit e1421dfd30
3 changed files with 13 additions and 0 deletions

View File

@@ -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()
}
}

View File

@@ -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)
}

View File

@@ -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)