Allow 20 minutes before checking for missing rows

Since we’ve doubled the number of rows in a job, jobs can take twice as
long to insert all the notifications. We don’t check for missing rows
until we’re pretty confident that the original tasks have finished
processing. This means we need to double the time we wait to still be
as sure.
This commit is contained in:
Chris Hill-Scott
2020-09-26 11:06:44 +01:00
parent 2af62bdd1f
commit aace1bdd8a
3 changed files with 38 additions and 8 deletions

View File

@@ -209,9 +209,9 @@ def can_letter_job_be_cancelled(job):
def find_jobs_with_missing_rows():
# Jobs can be a maximum of 50,000 rows. It typically takes 5 minutes to create all those notifications.
# Using 10 minutes as a condition seems reasonable.
ten_minutes_ago = datetime.utcnow() - timedelta(minutes=10)
# Jobs can be a maximum of 100,000 rows. It typically takes 10 minutes to create all those notifications.
# Using 20 minutes as a condition seems reasonable.
ten_minutes_ago = datetime.utcnow() - timedelta(minutes=20)
yesterday = datetime.utcnow() - timedelta(days=1)
jobs_with_rows_missing = db.session.query(
func.count(Notification.id).label('actual_count'),