lst_auto_rta.utils.queue.process_all_items

lst_auto_rta.utils.queue.process_all_items(q: Queue[Any], processed_items: set[Any], process_item_fct: Callable[[...], None], process_item_fct_extra_kwargs: Dict[str, Any]) int[source]

Empty q and apply process_item_fct on all items not in processed_items with kwargs from process_item_fct_extra_kwargs

Warning

If the queue is filled faster than this function empties it, this will create an infinite list!

Parameters:
  • q (Queue[Any]) – queue which items will be processed

  • processed_items (set[Any]) – Set of items that should not be processed.

  • process_item_fct (Callable[..., None]) – Function to apply to the queue items

  • process_item_fct_extra_kwargs (Dict[str, Any]) – Extra kwargs to pass to process_item_fct when proccessing items.

Returns:

The number of processed items.

Return type:

int