I’m creating a WordPress plugin and desires to run a background process that calls an API and updates database desk. Now, the API can solely give outcomes for five DB entries in a single go and for 500 entries in my desk, I’ve to make 100 API name. The API has allowed TPS quota of 1 and in addition in each 40 minutes, its outdated response expires which suggests I have to replace my desk if any entry is older than 40 minutes by making a brand new API name. And, all these DB entries need to be proven to the web page viewer with newest information.
The answer that I got here up with is scheduling a cron process that runs each minute and does API calls one after one other for 25 seconds after which dies in order that it would not exceed PHP max execution time restrict. And at time a buyer comes, he has to not look forward to API name or be throttled by API
However the issue is I can not depend on wp-cron as it will likely be known as solely when web page hit happens(not like precise cron and since I’m plugin developer I can not schedule a system cron on my buyer’s WordPress internet hosting setting). Additionally, if the individual receives just one web page hit in 3 hours, that first individual in 3 hours has to both look forward to these API calls to complete(in no way fascinating or higher to say possible) or else he is not going to be proven the info.
Is there every other approach to resolve this drawback of updating the DB entries through some background course of that’s neither slowing down the consumer and nor relying on web page load. So even when 4 purchasers are available in a day all of them get newest information (information up to date inside final 40 minutes) as its already been up to date within the background?