mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Fix - modified handling of failed syncs of files
This commit is contained in:
parent
ea4113c5e4
commit
e2420c2919
1 changed files with 17 additions and 5 deletions
|
|
@ -121,9 +121,7 @@ class SyncServer():
|
||||||
(list)
|
(list)
|
||||||
"""
|
"""
|
||||||
# retry_cnt - number of attempts to sync specific file before giving up
|
# retry_cnt - number of attempts to sync specific file before giving up
|
||||||
retries_str = "null," + \
|
retries_arr = self._get_retries_arr()
|
||||||
",".join([str(i)
|
|
||||||
for i in range(self.presets["retry_cnt"])])
|
|
||||||
active_providers_str = ",".join(self.active_provider_names)
|
active_providers_str = ",".join(self.active_provider_names)
|
||||||
query = {
|
query = {
|
||||||
"type": "representation",
|
"type": "representation",
|
||||||
|
|
@ -140,7 +138,7 @@ class SyncServer():
|
||||||
"$elemMatch": {
|
"$elemMatch": {
|
||||||
"name": {"$in": [active_providers_str]},
|
"name": {"$in": [active_providers_str]},
|
||||||
"created_dt": {"$exists": False},
|
"created_dt": {"$exists": False},
|
||||||
"tries": {"$nin": [retries_str]}
|
"tries": {"$in": retries_arr}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]},
|
}]},
|
||||||
|
|
@ -150,7 +148,7 @@ class SyncServer():
|
||||||
"$elemMatch": {
|
"$elemMatch": {
|
||||||
"name": self.presets["local_id"],
|
"name": self.presets["local_id"],
|
||||||
"created_dt": {"$exists": False},
|
"created_dt": {"$exists": False},
|
||||||
"tries": {"$nin": [retries_str]}
|
"tries": {"$in": retries_arr}
|
||||||
}
|
}
|
||||||
}}, {
|
}}, {
|
||||||
"files.sites": {
|
"files.sites": {
|
||||||
|
|
@ -536,6 +534,20 @@ class SyncServer():
|
||||||
target_root = '/{}'.format(root_name)
|
target_root = '/{}'.format(root_name)
|
||||||
return file.get("path", "").replace('{root}', target_root)
|
return file.get("path", "").replace('{root}', target_root)
|
||||||
|
|
||||||
|
def _get_retries_arr(self):
|
||||||
|
"""
|
||||||
|
Returns array with allowed values in 'tries' field. If repre
|
||||||
|
contains these values, it means it was tried to be synchronized
|
||||||
|
but failed. We try up to 'self.presets["retry_cnt"]' times before
|
||||||
|
giving up and skipping representation.
|
||||||
|
Returns:
|
||||||
|
(list)
|
||||||
|
"""
|
||||||
|
arr = [i for i in range(self.presets["retry_cnt"])]
|
||||||
|
arr.append(None)
|
||||||
|
|
||||||
|
return arr
|
||||||
|
|
||||||
|
|
||||||
class SynchServerThread(threading.Thread):
|
class SynchServerThread(threading.Thread):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue