Skip to content

Commit 8bfa9ba

Browse files
committed
going with the api supported way of setting initial state in the internal queue
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
1 parent 0d6eafb commit 8bfa9ba

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

receptor/buffers/file.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import os
55
import time
66
import uuid
7-
from collections import deque
87
from concurrent.futures import ThreadPoolExecutor
98

109
from .base import BaseBufferManager
@@ -26,11 +25,8 @@ def __init__(self, dir_, key, loop):
2625
os.makedirs(self._message_path, mode=0o700)
2726
except Exception:
2827
pass
29-
# We are setting the internal queue for the asyncio Queue to have a
30-
# default from what we have in the manifest. This relies on an
31-
# implementation detail of asyncio.Queue because there doesn't appear
32-
# to be a way to set initial state otherwise
33-
self.q._queue = deque(self._read_manifest())
28+
for item in self._read_manifest():
29+
self.q.put_nowait(item)
3430

3531
async def put(self, data):
3632
ident = str(uuid.uuid4())
@@ -103,9 +99,6 @@ async def expire(self):
10399
self.q = new_queue
104100

105101

106-
107-
108-
109102
class FileBufferManager(BaseBufferManager):
110103
_buffers = {}
111104

0 commit comments

Comments
 (0)