action-scheduler vs wp-background-processing

I am trying to create a user registration form that sends OTP over Email and SMS and display an OTP screen after the whole process completes.

How can I make the send_mail and send_sms to be in the background? I know it can be done through Ajax directly to reduce the processing time. But I am making this plugin on top of another one. So ajax way is not to fit in my case. I need to complete the whole thing in one PHP process. So I choose action-scheduler or wp-background-processing that schedule the jobs (send_mail and send_sms), complete the PHP process and display an OTP screen to user.

I need some help choosing the one fit for my plugin. Do both of the libraries provide job scheduling in the same way?

What will happen if 1000 users registered at once? Considering send_email and send_sms takes only 10 sec. How much time it will take to send an email and SMS to the 1000th user who is last in the queue? Is that user going to get the OTP after 999*10sec? So I don’t think it is perfect for my application. An OTP after 999*10 sec to too much of waiting time.

If I understand it perfectly what is the alternative way to achieve that?

0

Leave a Comment