Today I've experienced what might be a short Postmark API outage, which led to some customers not receiving emails.
Would it make sense to add a retry option to the JS client so that these kinds of errors can be worked around?
This is what I've added to my code today, but it might make sense to have this behavior be part of the client:
const sendEmail = async (/* params */)
let tries = 0;
while (true) {
try {
await postmark.sendEmailWithTemplate(/* params */);
break;
} catch (e) {
if (tries < 5) {
console.error("Couldn't send email, trying again:", e);
await new Promise((res) => setTimeout(res, 1000));
tries++;
} else {
throw e;
}
}
}
}
What do you think?
Today I've experienced what might be a short Postmark API outage, which led to some customers not receiving emails.
Would it make sense to add a retry option to the JS client so that these kinds of errors can be worked around?
This is what I've added to my code today, but it might make sense to have this behavior be part of the client:
What do you think?