normalize collision suffix

This commit is contained in:
ed 2021-10-19 00:49:35 +02:00
parent 42acc457af
commit 4f97d7cf8d
2 changed files with 4 additions and 3 deletions

View file

@ -1050,7 +1050,7 @@ class HttpCli(object):
if not bos.path.isdir(fdir): if not bos.path.isdir(fdir):
raise Pebkac(404, "that folder does not exist") raise Pebkac(404, "that folder does not exist")
suffix = ".{:.6f}-{}".format(time.time(), self.ip) suffix = "-{:.6f}-{}".format(time.time(), self.dip)
open_args = {"fdir": fdir, "suffix": suffix} open_args = {"fdir": fdir, "suffix": suffix}
else: else:
open_args = {} open_args = {}

View file

@ -1318,7 +1318,7 @@ class Up2k(object):
# TODO broker which avoid this race and # TODO broker which avoid this race and
# provides a new filename if taken (same as bup) # provides a new filename if taken (same as bup)
suffix = ".{:.6f}-{}".format(ts, ip) suffix = "-{:.6f}-{}".format(ts, ip.replace(":", "."))
with ren_open(fname, "wb", fdir=fdir, suffix=suffix) as f: with ren_open(fname, "wb", fdir=fdir, suffix=suffix) as f:
return f["orz"][1] return f["orz"][1]
@ -1877,7 +1877,8 @@ class Up2k(object):
del self.registry[job["ptop"]][job["wark"]] del self.registry[job["ptop"]][job["wark"]]
return return
suffix = ".{:.6f}-{}".format(job["t0"], job["addr"]) dip = job["addr"].replace(":", ".")
suffix = "-{:.6f}-{}".format(job["t0"], dip)
with ren_open(tnam, "wb", fdir=pdir, suffix=suffix) as f: with ren_open(tnam, "wb", fdir=pdir, suffix=suffix) as f:
f, job["tnam"] = f["orz"] f, job["tnam"] = f["orz"]
if ( if (