mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add Retry to save_load.
Same as retry in preg_jid this should help fix a race condition when jod id id is create and another process removes that. Fixes #28438.
This commit is contained in:
parent
643c9c9616
commit
186872cf49
1 changed files with 9 additions and 1 deletions
|
@ -200,10 +200,15 @@ def returner(load):
|
|||
)
|
||||
|
||||
|
||||
def save_load(jid, clear_load):
|
||||
def save_load(jid, clear_load, recurse_count=0):
|
||||
'''
|
||||
Save the load to the specified jid
|
||||
'''
|
||||
if recurse_count >= 5:
|
||||
err = 'save_load could not write job cache file after {0} retries.'.format(recurse_count)
|
||||
log.error(err)
|
||||
raise salt.exceptions.SaltCacheError(err)
|
||||
|
||||
jid_dir = _jid_dir(jid)
|
||||
|
||||
serial = salt.payload.Serial(__opts__)
|
||||
|
@ -235,6 +240,9 @@ def save_load(jid, clear_load):
|
|||
)
|
||||
except IOError as exc:
|
||||
log.warning('Could not write job invocation cache file: {0}'.format(exc))
|
||||
time.sleep(0.1)
|
||||
return save_load(jid=jid, clear_load=clear_load,
|
||||
recurse_count=recurse_count+1)
|
||||
|
||||
|
||||
def get_load(jid):
|
||||
|
|
Loading…
Add table
Reference in a new issue