From 8d94fe3ef5cd59f137eed61868486305da08744c Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 1 Dec 2021 21:20:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=BA=90=E7=AB=99=E6=97=B6?= =?UTF-8?q?=E5=8A=A0=E4=BA=92=E6=96=A5=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/serverconfigs/reverse_proxy_config.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/serverconfigs/reverse_proxy_config.go b/pkg/serverconfigs/reverse_proxy_config.go index 559769d..f5dcd63 100644 --- a/pkg/serverconfigs/reverse_proxy_config.go +++ b/pkg/serverconfigs/reverse_proxy_config.go @@ -196,8 +196,9 @@ func (this *ReverseProxyConfig) AddBackupOrigin(origin *OriginConfig) { // NextOrigin 取得下一个可用的后端服务 func (this *ReverseProxyConfig) NextOrigin(call *shared.RequestCall) *OriginConfig { - this.schedulingLocker.RLock() - defer this.schedulingLocker.RUnlock() + // 这里不能使用RLock/RUnlock,因为在NextOrigin()方法中可能会对调度对象动态调整 + this.schedulingLocker.Lock() + defer this.schedulingLocker.Unlock() if len(this.schedulingGroupMap) == 0 { return nil