Skip to content

Commit

Permalink
Merge pull request #117 from jd-opensource/116-fix-unit-route-without…
Browse files Browse the repository at this point in the history
…-unit-rule-id

Fix unit route without unit rule id
  • Loading branch information
chenzhiguo authored Oct 21, 2024
2 parents f515fd7 + d014653 commit 9efefe0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
import static com.jd.live.agent.governance.invoke.Invocation.*;

/**
* UnitInFilter
* UnitFilter
*
* @author Zhiguo.Chen
* @since 1.0.0
*/
@Extension(value = "UnitInFilter", order = InboundFilter.ORDER_LIVE_UNIT)
@Extension(value = "UnitFilter", order = InboundFilter.ORDER_LIVE_UNIT)
@ConditionalOnProperty(value = GovernanceConfig.CONFIG_LIVE_ENABLED, matchIfMissing = true)
public class UnitInFilter implements InboundFilter {
public class UnitFilter implements InboundFilter {

@Override
public <T extends InboundRequest> void filter(InboundInvocation<T> invocation, InboundFilterChain chain) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ private <T extends OutboundRequest> RouteTarget route(OutboundInvocation<T> invo
ServiceMetadata serviceMetadata = invocation.getServiceMetadata();
ServiceLivePolicy livePolicy = serviceMetadata.getServiceLivePolicy();
UnitPolicy unitPolicy = serviceMetadata.getUnitPolicy();
if (liveMetadata.getUnitRuleId() == null) {
// Not live domain
return routeNone(invocation, endpoints, liveMetadata);
}
switch (unitPolicy) {
case NONE:
return routeNone(invocation, endpoints, liveMetadata);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
com.jd.live.agent.governance.invoke.filter.inbound.ReadyFilter
com.jd.live.agent.governance.invoke.filter.inbound.AuthFilter
com.jd.live.agent.governance.invoke.filter.inbound.PermissionFilter
com.jd.live.agent.governance.invoke.filter.inbound.UnitInFilter
com.jd.live.agent.governance.invoke.filter.inbound.UnitFilter
com.jd.live.agent.governance.invoke.filter.inbound.CellFilter
com.jd.live.agent.governance.invoke.filter.inbound.FailoverFilter
com.jd.live.agent.governance.invoke.filter.inbound.RateLimitFilter
Expand Down

0 comments on commit 9efefe0

Please sign in to comment.