def put_new_list(self, new_list, from_dump=False): """ Empty and refill the queue. :param list new_list: nested list with hostname and source e.g. [ ["google.com", ["alexa-top-1m", ] ], ] :param bool from_dump: should be set to True if function call is used to fill the queue from dump """ self._new_list_holder = new_list # if no list has been supplied, leave method and continue if not self._new_list_holder: return # Trap if sslyze is working the list for the fist time or is in the middle of working it the n-th time if self._counter > 0 or self._times_fully_parsed == 0: return # dump if not from_dump: Dumper.dump_queue(self._new_list_holder) print("adding new list ...") # indicates that the queue will be filled currently self._is_filling = True self.empty_queue() # self_counter is reset to 0 in here for i, item in enumerate(new_list): self._host_source_dict[item[0]] = item[1] self._host_queue.put(item[0]) print("new list was added") self._times_fully_parsed = 0 self._current_list_holder = self._new_list_holder self._new_list_holder = None self._is_filling = False with self._filling_condition: self._filling_condition.notify_all()