Skip to content
Snippets Groups Projects
Commit 763d8a7f authored by Robert Latta's avatar Robert Latta
Browse files

added set_single_latch ready for update task transaction. RE. DBOARD3-433

parent 4b5efaa8
No related branches found
No related tags found
No related merge requests found
...@@ -98,7 +98,7 @@ def update_latch_status(config, pending=False, failure=False): ...@@ -98,7 +98,7 @@ def update_latch_status(config, pending=False, failure=False):
if not pending and not failure: if not pending and not failure:
if not latch['pending'] and not latch['failure']: if not latch['pending'] and not latch['failure']:
logger.error( logger.error(
'updating latch for db {db} with pending=failure=True, ' f'updating latch for db {db} with pending=True, '
f'but latch is already {latch}') f'but latch is already {latch}')
latch['timestamp'] = now latch['timestamp'] = now
latch['pending'] = pending latch['pending'] = pending
...@@ -112,17 +112,21 @@ def set_latch(config, new_current, new_next, timestamp): ...@@ -112,17 +112,21 @@ def set_latch(config, new_current, new_next, timestamp):
new_current, new_next)) new_current, new_next))
for db in config['redis-databases']: for db in config['redis-databases']:
latch = {
'current': new_current,
'next': new_next,
'this': db,
'pending': False,
'failure': False,
'timestamp': timestamp
}
r = _get_redis(config, dbid=db) r = _get_redis(config, dbid=db)
r.set('db:latch', json.dumps(latch)) set_single_latch(r, db, new_current, new_next, timestamp)
def set_single_latch(r, db, new_current, new_next, timestamp):
latch = {
'current': new_current,
'next': new_next,
'this': db,
'pending': False,
'failure': False,
'timestamp': timestamp
}
r.set('db:latch', json.dumps(latch))
def latch_db(config): def latch_db(config):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment