Skip to content

Commit b17cf05

Browse files
committed
feat: Apply PreferredURLPatterns to Configuration refresh server list
The RefresherBase now respects the PreferredURLPatterns option when randomizing server lists, ensuring preferred servers are tried first while maintaining randomization within each priority group.
1 parent 2d52fb5 commit b17cf05

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/DIRAC/ConfigurationSystem/private/RefresherBase.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import time
22

33
from DIRAC.ConfigurationSystem.Client.ConfigurationData import gConfigurationData
4-
from DIRAC.ConfigurationSystem.Client.PathFinder import getGatewayURLs
4+
from DIRAC.ConfigurationSystem.Client.PathFinder import getGatewayURLs, groupURLsByPriority
55
from DIRAC.Core.Utilities import List
66
from DIRAC.Core.Utilities.EventDispatcher import gEventDispatcher
77
from DIRAC.Core.Utilities.ReturnValues import S_ERROR, S_OK
@@ -138,7 +138,9 @@ def _refresh(self, fromMaster=False):
138138
if not initialServerList:
139139
return S_OK()
140140

141-
randomServerList = List.randomize(initialServerList)
141+
randomServerList = []
142+
for urlGroup in groupURLsByPriority(initialServerList):
143+
randomServerList.extend(List.randomize(urlGroup))
142144
gLogger.debug(f"Randomized server list is {', '.join(randomServerList)}")
143145

144146
for sServer in randomServerList:

0 commit comments

Comments
 (0)