Add tests and documentation for unlock_reason

This commit is contained in:
Matthias
2021-10-30 09:39:40 +02:00
parent e9d71f26b3
commit c579fcfc19
4 changed files with 36 additions and 3 deletions

View File

@@ -116,14 +116,14 @@ class PairLocks():
if PairLocks.use_db:
# used in live modes
logger.info(f"Releasing all locks with reason \'{reason}\':")
logger.info(f"Releasing all locks with reason '{reason}':")
filters = [PairLock.lock_end_time > now,
PairLock.active.is_(True),
PairLock.reason == reason
]
locks = PairLock.query.filter(*filters)
for lock in locks:
logger.info(f"Releasing lock for {lock.pair} with reason \'{reason}\'.")
logger.info(f"Releasing lock for {lock.pair} with reason '{reason}'.")
lock.active = False
PairLock.query.session.commit()
else: