mozilla/ichnaea — pull request #217 by graydon (2014-05-30 00:58:48+00:00)
Title: Sketch of fix for issue #205, general cross-checking / refinement of results

Not really suggesting we merge this yet, just thought I'd put a PR up to show what I have in mind here. This generalizes solutions to #205 and #206, basically just switching to a "zoom in" approach to answering queries. We fetch all the results we can get, then start with the least-accurate and successively try to refine it so long as the next-best result doesn't contradict the existing one (i.e. lie outside the accuracy-radius already established).

Currently I left it reporting all the hits whether or not it uses them, so for example if you get a non-contradictory geoip + wifi hit it'll return the wifi result and emit two heka counters, one for geoip and one for wifi. Maybe I should change this to only increment the counter it selected the data source for?