Commit 527a324 1 parent af70c33 commit 527a324 Copy full SHA for 527a324
File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 8
8
from kombu .utils .encoding import bytes_to_str
9
9
from kombu .utils .json import loads
10
10
11
- from ..contrib .kombu_filesystem import backport_filesystem_transport
11
+ from ..contrib .kombu_filesystem import (
12
+ LOCK_SH ,
13
+ backport_filesystem_transport ,
14
+ lock ,
15
+ unlock ,
16
+ )
12
17
from ..utils import makedirs , remove , unc_path
13
18
14
19
logger = logging .getLogger (__name__ )
@@ -122,12 +127,18 @@ def _iter_folder(
122
127
path = os .path .join (folder , filename )
123
128
try :
124
129
with open (path , "rb" ) as fobj :
125
- payload = fobj .read ()
130
+ lock (fobj , LOCK_SH )
131
+ try :
132
+ payload = fobj .read ()
133
+ finally :
134
+ unlock (fobj )
126
135
except FileNotFoundError :
127
136
# Messages returned by `listdir` call may have been
128
137
# acknowledged and moved to `processed_folder` by the
129
138
# time we try to read them here
130
139
continue
140
+ if not payload :
141
+ continue
131
142
msg = channel .Message (
132
143
loads (bytes_to_str (payload )), channel = channel
133
144
)
You can’t perform that action at this time.
0 commit comments