Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acoustic.py resync should set retries column to 0 #806

Closed
leplatrem opened this issue Sep 1, 2023 · 1 comment · Fixed by #822
Closed

acoustic.py resync should set retries column to 0 #806

leplatrem opened this issue Sep 1, 2023 · 1 comment · Fixed by #822
Labels
bug Something isn't working

Comments

@leplatrem
Copy link
Contributor

If a contact has retries=5, it won't be synchronized.

If this contact is among the specified list for acoustic.py resync then it won't be resynced.

PendingAcousticRecord(email_id=email.email_id) for email in statement.all()

We should upsert the PendingAcousticRecord with retries=0

@grahamalama
Copy link
Contributor

grahamalama commented Sep 12, 2023

Possibly related, but I just noticed that we don't have a unique index for email_id on the "pending_acoustic" table.

So not only does bulk_schedule_acoustic_records not reset the retry column, but it adds a new record, even if one already exists:

email = Email(...)
pending_record = PendingAcousticRecord(email_id=email.email_id, retry=5)
dbsession.add(email)
dbsession.add(pending_record)
dbsession.commit()

bulk_schedule_acoustic_records(dbsession, [email.primary_email])
dbsession.commit()

print(len(dbsession.query(PendingAcousticRecord).all()))

2

leplatrem added a commit that referenced this issue Sep 22, 2023
…command (#822)

* Ref #806: prevent duplicate entries in pending records table

* Fix #806: reset retry and last_retry on resync command

* Flush db before scheduling pending record

* @grahamalama feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants