File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 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):
205205 writer .close ()
206206 # END assure target stream is closed
207207 except :
208- if tmp_path :
209- os . remove (tmp_path )
208+ with suppress ( FileNotFoundError ) :
209+ remove (tmp_path )
210210 raise
211211 # END assure tmpfile removal on error
212212
@@ -230,17 +230,21 @@ def store(self, istream):
230230 tmp_path = None
231231 # end rename only if needed
232232
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
236235 with suppress (PermissionError ):
236+ # make sure its readable for all ! It started out as rw-- tmp file
237+ # but needs to be rwrr
237238 chmod (obj_path , self .new_objects_mode )
238239 break
239- time .sleep (0.5 )
240+ time .sleep (0.1 )
240241 else :
241242 raise PermissionError ("Impossible to apply `chmod` to file {}" .format (obj_path ))
242243 # END handle dry_run
243244
245+ with suppress (FileNotFoundError ):
246+ remove (tmp_path )
247+
244248 istream .binsha = hex_to_bin (hexsha )
245249 return istream
246250
You can’t perform that action at this time.
0 commit comments