mirror of
https://github.com/newnius/YAO-agent.git
synced 2025-12-12 21:16:44 +00:00
retry when creating dir failed
This commit is contained in:
7
agent.py
7
agent.py
@@ -299,13 +299,20 @@ class MyHandler(BaseHTTPRequestHandler):
|
||||
token = generate_token(16)
|
||||
|
||||
if len(dfs_src) > 0:
|
||||
failed_cnt = 0
|
||||
while True:
|
||||
failed_cnt += 1
|
||||
if failed_cnt > 3:
|
||||
break
|
||||
try:
|
||||
# Docker wouldn't create dir by default on bind mode,
|
||||
# see https://github.com/moby/moby/issues/13121
|
||||
path = Path(dfs_src)
|
||||
path.mkdir(parents=True, exist_ok=True)
|
||||
break
|
||||
except OSError as e:
|
||||
print("Creation of the directory %s failed" % dfs_src)
|
||||
print(e)
|
||||
print(traceback.format_exc())
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user