I'm trying to use queuelib github to implement a stored in disk (persisted to disk) fixed size queue.
Code snapshot:
from queuelib import FifoDiskQueue
images_data = FifoDiskQueue(r"c:\temp")
while True:
# doing something
frame = np.random.rand(3,2)
# implement fixed size queue
if len(images_data) >= 10:
images_data.pop()
images_data.push(frame.tobytes()) # add the new frame to the main database
# after the while loop ends
images_data.close() # close the handle to the queue
While running it for long time I observed that:
- Queue file
q00000is always 0 KB - Device's disk memory is decreasing until it reach the limit of the PC memory. I think that the queue is keep getting bigger and bigger although I'm "pop-ing" out any old element before adding new ones...
I'm using Windows with Python 3.8
Can some help me figure out why the size keep getting bigger or point me to the right way to implement a fixed size queue?
Thank you!!!