Stream-Framework icon indicating copy to clipboard operation
Stream-Framework copied to clipboard

FallbackHashCache::get_many need a protection from get_many_from_fallback invoke

Open microelec opened this issue 10 years ago • 0 comments

Hi,

FallbackHashCache::get_many() ... # query missing results from the database and store them if database_fallback: missing_keys = [f for f in fields if not results[f]] database_results = self.get_many_from_fallback(missing_keys) # update our results with the data from the db and send them to # redis results.update(database_results) self.set_many(database_results.items()) When I am trying to use the fallback db functionality, I have some finding for you reference.

  1. missing_keys could be an empty list, better to skip following query from DB.
  2. database_results could be empty list too if query db returning a null list. this will raise a exception when database_results.items().

microelec avatar Aug 14 '15 05:08 microelec