Matt Domsch wrote:
On Mon, Nov 05, 2007 at 08:15:07AM -0800, Toshio Kuratomi wrote:
> Matt Domsch wrote:
>
>
>> 2) If a user isn't resolved by GeoIP, they will be given the global
>> list, but without excluding mirrors who have an Exclusive Country
>> set (e.g. Vasile's server really only wants traffic from .md users,
>> but he sees global users). This requires a change to
>> mirrorlist_server.py trim_by_client_country() which I haven't made
>> yet, but will look into doing so. We should make this change to
>> provide better accurate clients to our mirrors to keep their
>> expenses down. I'll post the patch here for review before implementing.
>>
> I'm not sure how invasive this will be but it does sound like something
> we want to keep our mirrors happy. Maybe seeing the patch first will
> be better for deciding if it's too big a change during the freeze.
>
Here's the resulting function. I think this is very clear code now,
and it works for me tested against live data on pt1.
def trim_by_client_country(hostresults, clientCountry):
results = []
for hostid, hcurl in hostresults:
if hostid not in host_country_allowed_cache or \
clientCountry in host_country_allowed_cache[hostid]:
results.append((hostid, hcurl))
return results
Patch follows.
+1 from me, can I get atleast a +1 from someone else in sysadmin-main?
Its tested, low risk (as in we can roll back if there's any issues)
-Mike