code: def refill_queue(self):
          
          self.thread.pause()     # pause enqueue
  
          opt = tfv1.RunOptions()
          opt.timeout_in_ms = 2000   # 2s
          sess = tfv1.get_default_session()
          # dequeue until empty
          try:
              while True:
                  sess.run(self._dequeue_op, options=opt)
          except tf.errors.DeadlineExceededError:
              pass
  
          # reset dataflow, start thread
          self.thread.reinitialize_dataflow()
          self.thread.resume()
docs: Clear the queue, then call dataflow.__iter__() again and fill into the queue.