On Sunday March 24 2013 05:57:49 Dan Mahoney, System Admin wrote: > sa-update also uses a mirror file which lists all of the URLs where the > update can be downloaded from, optionally including weights for different > mirrors. > But there's no documentation or examples given for weighting. Anyone > closer to the code know what this would look like?
$ curl http://spamassassin.apache.org/updates/MIRRORED.BY http://sa-update.dnswl.org/ weight=1 http://www.sa-update.pccc.com/ weight=5 http://sa-update.secnap.net/ weight=5 sa-update has the following in its comments: # choose a random integer between 0 and the total weight of all mirrors # loop through the mirrors from largest to smallest weight # if random number is < largest weight, use it # otherwise, random number -= largest, remove mirror from list, try again # eventually, there'll just be 1 mirror left in $mirrors[0] and it'll be used # sub choose_mirror { my($mirror_list) = @_; [...] Mark
