Skip to content

Commit

Permalink
使用ip地址作为HashingLoadBalancer的hash key (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanpf authored Sep 4, 2023
1 parent f224780 commit 79bddca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pjs/http/forward.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
_unhealthCache: null,
_healthCheckTarget: null,
_targetResource: null,
_balancerKey: undefined,
})

.import({
Expand Down Expand Up @@ -212,7 +213,8 @@
_cookieId ? (
__target = _cookieId
) : (
(_targetResource = _targetBalancer?.borrow?.(undefined, undefined, _unhealthCache)) && (
(__service?.Algorithm === 'HashingLoadBalancer') && (_balancerKey = __inbound.remoteAddress),
(_targetResource = _targetBalancer?.borrow?.(undefined, _balancerKey, _unhealthCache)) && (
__target = _targetResource?.id
)
),
Expand Down

0 comments on commit 79bddca

Please sign in to comment.