File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -205,8 +205,8 @@ def store(self, istream):
205
205
writer .close ()
206
206
# END assure target stream is closed
207
207
except :
208
- if tmp_path :
209
- os . remove (tmp_path )
208
+ with suppress ( FileNotFoundError ) :
209
+ remove (tmp_path )
210
210
raise
211
211
# END assure tmpfile removal on error
212
212
@@ -230,17 +230,21 @@ def store(self, istream):
230
230
tmp_path = None
231
231
# end rename only if needed
232
232
233
- # make sure its readable for all ! It started out as rw-- tmp file
234
- # but needs to be rwrr
235
- for _ in range (3 ):
233
+ # Ensure rename is actually done and file is stable
234
+ for _ in range (10 ): # Retry up to 10 times
236
235
with suppress (PermissionError ):
236
+ # make sure its readable for all ! It started out as rw-- tmp file
237
+ # but needs to be rwrr
237
238
chmod (obj_path , self .new_objects_mode )
238
239
break
239
- time .sleep (0.5 )
240
+ time .sleep (0.1 )
240
241
else :
241
242
raise PermissionError ("Impossible to apply `chmod` to file {}" .format (obj_path ))
242
243
# END handle dry_run
243
244
245
+ with suppress (FileNotFoundError ):
246
+ remove (tmp_path )
247
+
244
248
istream .binsha = hex_to_bin (hexsha )
245
249
return istream
246
250
You can’t perform that action at this time.
0 commit comments