Skip to content

Conversation

@jdarwood007
Copy link
Member

This resolves the mail queue needing to handle failed emails better by implementing 3 additional columns for tracking failures.

  • This code does not yet make use of the extra column. This is a placeholder should the need arise to add additional changes to the queue after a stable release.
  • tries column will hold the number of times this was put back into the queue, if the max is reached, the email is removed from the queue.
  • next_try column holds the time we will next try. The select statement is updated to only grab stuff at the current time for before.
  • calculateNextTry() sets up the next time we send by a exponential increase based on the number of tries we have done ensuring we increase our delay ever greater.

@jdarwood007 jdarwood007 added the Mail E-mail label Jul 25, 2025
Copy link
Member

@Sesquipedalian Sesquipedalian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need for a migration step. The upgrader will automatically take care of normalizing the table (meaning, in this case, adding the new columns):

// Ensure the tables are structured correctly.
foreach (Table::getAll($ns) as $table) {
$substeps[] = new GenericSubStep(
name: Lang::getTxt('upgrade_normalizing_table', ['table' => Config::$db_prefix . $table->name], file: 'Maintenance'),
exec: [$table, 'normalize'],
);
}
}

@jdarwood007
Copy link
Member Author

Should we rely on that or ensure that the upgraded schema is in place and let the catchall be the final cleanup? I had assumed it was the latter and would be our safety catch.

@Sesquipedalian
Copy link
Member

Sesquipedalian commented Aug 8, 2025

If the new table needs to exist in order to perform additional migration steps, then creating it is fine. But if that isn't the case, then leaving it until that final step makes good sense. Why have redundant code?

This resolves the mail queue needing to handle failed emails better by implementing 3 additional columns for tracking failures.

- This code does not yet make use of the `extra` column.  This is a placeholder should the need arise to add additional changes to the queue after a stable release.
- `tries` column will hold the number of times this was put back into the queue, if the max is reached, the email is removed from the queue.
- `next_try` column holds the time we will next try.  The select statement is updated to only grab stuff at the current time for before.
- `calculateNextTry()` sets up the next time we send by a exponential increase based on the number of tries we have done ensuring we increase our delay ever greater.
@jdarwood007 jdarwood007 force-pushed the 3.0/MailQueueExtension branch from 986813f to a3e7386 Compare October 26, 2025 17:55
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 5 milestone Oct 26, 2025
@jdarwood007 jdarwood007 merged commit c9c625e into SimpleMachines:release-3.0 Oct 26, 2025
7 checks passed
@jdarwood007 jdarwood007 deleted the 3.0/MailQueueExtension branch October 26, 2025 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Mail E-mail

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants