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

[NEW FEAT] Add estimated remaining time when the hourly mail merge process is triggered #165

Open
ttsukagoshi opened this issue Feb 21, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@ttsukagoshi
Copy link
Owner

ttsukagoshi commented Feb 21, 2022

Pull request #164 introduced a new feature/bugfix where the mail merge process (SEND EMAILS and CREATE DRAFTS) that took longer than the execution time limit of postProcessMailMerge, i.e., the apps script's 6-min limit, is handed over to another hourly triggered postProcessMailMerge to work around the Exceeded maximum execution time error.

It would have been more than convenient for users if this second trigger could be executed at a more frequent interval than an hour, but there is an undocumented limitation that recursive time-based triggers created by add-ons must be set at an interval of at least one hour, else it would throw an exception with the following message:

Exception: The recurrence interval for an Add-on trigger must be at least one hour.

To comply with this limitation while maintaining the user experience of the add-on at a certain level, I've broken down the post-process into two steps in the said PR. The first postProcessMailMerge will be triggered on ClockTriggerBuilder.after(milliseconds):

if (!isTimeTriggered) {
  ScriptApp.newTrigger('postProcessMailMerge')
    .timeBased()
    .after(EXECUTE_TRIGGER_AFTER)
    .create();
}

whereas the subsequent postProcessMailMerge, whose time-based trigger will be set when the first round of execution is expected to take longer than the 6-min limit, will be set by ClockTriggerBuilder.everyHours(1) (where 1 is the smallest acceptable number)

else if (debugInfo.exeRounds == 1) {
  ScriptApp.newTrigger('postProcessMailMerge')
    .timeBased()
    .everyHours(1)
    .create();
}

While I believe this is the best possible solution currently available, I understand this 1-hour interval will be frustrating for users who are not aware of this process, as it will keep them waiting throughout the recursive hourly executions. To properly inform the user, I would like to add the estimated remaining time to the MESSAGE.<userLocale>.continuingPostProcess.

@ttsukagoshi ttsukagoshi added the enhancement New feature or request label Feb 21, 2022
@ttsukagoshi ttsukagoshi added this to the v3.1.0 milestone Feb 21, 2022
@ttsukagoshi ttsukagoshi self-assigned this Feb 21, 2022
@ttsukagoshi ttsukagoshi modified the milestones: v3.1.0, v3.2.0 Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant