flanker
flanker copied to clipboard
Cache interface does not work with dict semantics
When mail_exchanger_lookup()
fails to connect to the mail exchanger for a specific domain, it sets the corresponding cache entry to False
(line 149). However, lookup_exchanger_in_cache()
looks for the string 'False'
to figure out if there was an MX connection failure for a domain in cache.
This asymmetry means that caches that implement proper dict semantics (i.e. not coercing all values to strings unlike the Redis driver) fail miserably. I believe that a simple in memory cache like defaultdict(lambda: None)
should just work and not fail with TypeError. This behaviour is also the root cause for https://github.com/mailgun/flanker/pull/31.