From 53c8e3510fd1f6cd9a706349eb09fa04fe2ff97f Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sat, 30 Nov 2024 10:01:55 +1300 Subject: [PATCH] daily maintenance - commit more often --- app/cli.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/cli.py b/app/cli.py index 717a1dff..13cdbc2a 100644 --- a/app/cli.py +++ b/app/cli.py @@ -251,8 +251,10 @@ def register(app): except Exception as e: db.session.rollback() current_app.logger.error(f"Error processing instance {instance.domain}: {e}") + instance.failures += 1 finally: nodeinfo.close() + db.session.commit() if instance.nodeinfo_href: try: @@ -271,6 +273,7 @@ def register(app): current_app.logger.error(f"Error processing nodeinfo for {instance.domain}: {e}") finally: node.close() + db.session.commit() # Handle admin roles if instance.online() and (instance.software == 'lemmy' or instance.software == 'piefed'): @@ -299,9 +302,7 @@ def register(app): finally: if response: response.close() - - # Commit all changes at once - db.session.commit() + db.session.commit() except Exception as e: db.session.rollback()