def fill_global_query_queue(eligible_queries=None): queue_name = settings.REDSHIFT_ANALYTICS_QUERY_QUEUE_NAME messages = get_queries_for_cache_warming(eligible_queries) log.info("Generated %i global query permutations for cache warming." % len(messages)) stale_queries = filter_freshly_cached_queries(messages) msg = "%i permutations remain after filtering fresh queries" % len( stale_queries) log.info(msg) write_messages_to_queue(queue_name, stale_queries)
def fill_personalized_query_queue(contexts, eligible_queries=None): queue_name = settings.REDSHIFT_PERSONALIZED_QUERY_QUEUE_NAME messages = get_personalized_queries_for_cache_warming( contexts, eligible_queries) log.info("Generated %i personalized permutations for cache warming." % len(messages)) stale_queries = filter_freshly_cached_queries(messages) msg = "%i personalized perms remain after filtering fresh queries" % len( stale_queries) log.info(msg) write_messages_to_queue(queue_name, stale_queries)