Compare commits

..

No commits in common. "d5eecd9220d42b2787fd00043b079357e29acfa6" and "297c7d1789dfb7f63e21e4cddbd5f7e524d72bb1" have entirely different histories.

3 changed files with 1 additions and 37 deletions

View File

@ -1 +1 @@
v20260108-26-mail-move-only-after-successful-import
v20260108-26-changelog-0.1.18-update

View File

@ -436,21 +436,6 @@ def run_auto_import(settings: SystemSettings):
new_messages = 0
auto_approved = 0
auto_approved_runs = []
# Never move messages when the import failed (prevents "moved but not stored" situations).
processed_folder_id = None
# Ensure imported messages are committed before moving them to another folder.
# If commit fails, do not move anything.
if processed_folder_id and new_messages >= 0:
try:
db.session.commit()
except Exception as exc:
db.session.rollback()
errors.append(f"Failed to commit imported messages: {exc}")
new_messages = 0
auto_approved = 0
auto_approved_runs = []
processed_folder_id = None
# Move messages to the processed folder if configured
if processed_folder_id:
@ -628,21 +613,6 @@ def run_manual_import(settings: SystemSettings, batch_size: int):
errors.append(str(exc))
new_messages = 0
auto_approved_runs = []
# Never move messages when the import failed (prevents "moved but not stored" situations).
processed_folder_id = None
# Ensure imported messages are committed before moving them to another folder.
# If commit fails, do not move anything.
if processed_folder_id and new_messages >= 0:
try:
db.session.commit()
except Exception as exc:
db.session.rollback()
errors.append(f"Failed to commit imported messages: {exc}")
new_messages = 0
auto_approved = 0
auto_approved_runs = []
processed_folder_id = None
# Move messages to the processed folder if configured
if processed_folder_id:

View File

@ -1,9 +1,3 @@
## v20260108-26-mail-move-only-after-successful-import
- Changed mail import flow so messages are only moved to the processed folder after a successful database store and commit.
- Prevented Graph mails from being moved when parsing, storing, or committing to the database fails.
- Added explicit commit and rollback handling to ensure database integrity before mail state changes.
- Improved logging around import and commit failures to better trace skipped or retried mails.