Skip to content

Supporting timeout  #5

Description

@thomashirtz

Hello!
I wanted to know, when adding an element to a queue that is full, like in this test:

def test():
    shape = (100, 100)
    num_elements = 10

    data = np.random.random(size=shape)
    mbytes = data.nbytes/1_000_000*num_elements

    queue = ArrayQueue(max_mbytes=mbytes)
    for i in range(2*num_elements):
        print(i)
        queue.put(data)

Instead of throwing an error :

Traceback (most recent call last):
  File "D:/Thomas/Python/treequeues/test_treequeues.py", line 99, in <module>
    test()
  File "D:/Thomas/Python/treequeues/test_treequeues.py", line 77, in test
    queue.put(data)
  File "D:\Thomas\Python\treequeues\venv\lib\site-packages\arrayqueues\shared_arrays.py", line 87, in put
    self.check_full()
  File "D:\Thomas\Python\treequeues\venv\lib\site-packages\arrayqueues\shared_arrays.py", line 73, in check_full
    raise Full(
queue.Full: Queue of length 10 full when trying to insert 0, last item read was 0

Would it be possible to be able to hang like multprocessing queue ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions