mirror of
https://github.com/norohind/jubilant-system-core.git
synced 2025-07-19 17:51:37 +03:00
Compare commits
No commits in common. "1dfaa3cde29c5dda043ee631ae9f27dd2207fb06" and "fafb95123c283d3f5423015e5ed5244395e59637" have entirely different histories.
1dfaa3cde2
...
fafb95123c
@ -22,7 +22,7 @@ def check_int(func: callable) -> callable:
|
||||
def _last_records(operation_id: int, limit: int) -> list[dict]:
|
||||
last_exception: Exception | None = None
|
||||
|
||||
for retry in range(0, 10):
|
||||
for retry in range(0, 3):
|
||||
try:
|
||||
return Hook.get_db().execute(
|
||||
HookUtils.SQL_REQUESTS.GET_HISTORICAL_INFO,
|
||||
@ -41,9 +41,6 @@ def _last_records(operation_id: int, limit: int) -> list[dict]:
|
||||
last_exception = e
|
||||
continue
|
||||
|
||||
with open('retries_list.txt', mode='a') as retries_file:
|
||||
retries_file.write(f'{operation_id}:{limit} \n')
|
||||
|
||||
raise last_exception
|
||||
|
||||
|
||||
|
19
main.py
19
main.py
@ -126,10 +126,9 @@ def discover(back_count: int = 0):
|
||||
tries = tries + 1
|
||||
|
||||
|
||||
def update(squad_id: int = None, amount_to_update: int = 1, suppress_absence=True):
|
||||
def update(squad_id: int = None, amount_to_update: int = 1):
|
||||
"""
|
||||
|
||||
:param suppress_absence: if we're manually updating a squadron which we know for sure are deleted
|
||||
:param squad_id: update specified squad, updates only that squad
|
||||
:param amount_to_update: update specified amount, ignores when squad_id specified
|
||||
:return:
|
||||
@ -137,7 +136,7 @@ def update(squad_id: int = None, amount_to_update: int = 1, suppress_absence=Tru
|
||||
|
||||
if isinstance(squad_id, int):
|
||||
logger.debug(f'Going to update one specified squadron: {squad_id} ID')
|
||||
FAPI.update_squad(squad_id, suppress_absence=suppress_absence)
|
||||
FAPI.update_squad(squad_id, suppress_absence=True)
|
||||
# suppress_absence is required because if we're manually updating squad with some high id it may just don't exist yet
|
||||
return
|
||||
|
||||
@ -171,7 +170,6 @@ def main():
|
||||
main.py update
|
||||
main.py update amount <amount: int>
|
||||
main.py update id <id: int>
|
||||
main.py force-update id <id: int>
|
||||
main.py daemon
|
||||
main.py hooks notify <inserted;deleted> <operation_id: int>"""
|
||||
|
||||
@ -223,8 +221,8 @@ def main():
|
||||
exit(1)
|
||||
|
||||
elif len(sys.argv) == 4:
|
||||
if sys.argv[1] in ('update', 'force-update'):
|
||||
if sys.argv[2] == 'amount' and sys.argv[1] == 'update':
|
||||
if sys.argv[1] == 'update':
|
||||
if sys.argv[2] == 'amount':
|
||||
# main.py update amount <amount: int>
|
||||
|
||||
try:
|
||||
@ -241,13 +239,6 @@ def main():
|
||||
|
||||
elif sys.argv[2] == 'id':
|
||||
# main.py update id <id: int>
|
||||
# main.py force-update id <id: int>
|
||||
if sys.argv[1] == 'force-update':
|
||||
suppress_absence = False
|
||||
|
||||
else:
|
||||
suppress_absence = True
|
||||
|
||||
try:
|
||||
id_for_update: int = int(sys.argv[3])
|
||||
|
||||
@ -257,7 +248,7 @@ def main():
|
||||
exit(1)
|
||||
|
||||
logger.info(f'Entering update specified squad: {id_for_update} ID')
|
||||
update(squad_id=id_for_update, suppress_absence=suppress_absence)
|
||||
update(squad_id=id_for_update)
|
||||
exit(0)
|
||||
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user