Advertisement
Guest User

Untitled

a guest
Feb 5th, 2021
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. minimum_check_threshold = 5  # How many entities are not found in a row before the expensive lookup is triggered
  2.  
  3. while True:
  4.  
  5.     checked_entity_types = set()
  6.     for entity_type, entities in build_queue.items():
  7.  
  8.         not_found_count = 0
  9.  
  10.         for entity in entities:
  11.             try:
  12.                 request_construction(entity)
  13.  
  14.             except NoEntityFoundError:
  15.                 not_found_count += 1
  16.  
  17.                 if not_found_count > minimum_check_threshold and entity_type not in checked_entity_types:
  18.                     if not check_entity_availability(entity_type):  # Query against every logistic network
  19.                         break
  20.                     checked_entity_types.add(entity_type)
  21.  
  22.             else:
  23.                 not_found_count = 0
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement