fix: add delay before triggering email (#458)

This commit is contained in:
Sebastian Rindom
2021-10-06 17:32:01 +02:00
committed by GitHub
parent 66b17055ea
commit ee2f7c6333

View File

@@ -111,6 +111,12 @@ class RestockNotificationService extends BaseService {
* @return {Promise<RestockNotification>} The resulting restock notification
*/
async triggerRestock(variantId) {
if (this.options_?.trigger_delay) {
await new Promise((resolve) =>
setTimeout(resolve, this.options_.trigger_delay)
)
}
return this.atomicPhase_(async (manager) => {
const restockRepo = manager.getRepository(this.restockNotificationModel_)