The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Scheduled Task - Run Every 5 Seconds
I've created a Scheduled Task that will submit a request to an API and store the value returned in a table in my database.
I'm interested in having this Scheduled Task run every 5 seconds, yet in the vB3 AdminCP, the only fields I see are Day of the Week, Day of the Month, Hour, and Minute. However, Minute has 6 fields attributed to it, which I am also confused about. How would I get my Scheduled Task to run every 5 seconds through vBulletin? Thanks, Mark |
#2
|
|||
|
|||
There are 6 "minute" fields because you can schedule a task to run up to 6 times per hour at certain minutes of the hour. If you choose '*' then it will run once per minute, but that's the most often you can schedule a task to run (unless you modify the code somehow).
I'm assuming that you're using the returned value somewhere, maybe you could do something like before it's displayed check to see if it's more than 5 seconds old, and if it is, request it before displaying it. But then I guess you'd also need a way to keep it from constantly being requested by multiple threads, especially if you have a very busy site, |
#3
|
||||
|
||||
Quote:
Would the following settings be what I'm after if I wish to have my Task run every minute? |
#4
|
|||
|
|||
Yes, I believe that would do it.
But in case you're not aware, the tasks run when users view your forum pages, so the timing it approximate, and it will only run once per minute if you have enough traffic to your site. |
Благодарность от: | ||
Mko |
#5
|
||||
|
||||
That should do it. Be aware that the Scheduled Tasks only run if you have users on your site. The tasks will backup if you don't have people clicking on your site.
|
Благодарность от: | ||
Mko |
#6
|
||||
|
||||
I see! Thanks for the information.
As a follow-up question... I have a custom bridge I developed with vB. Since both you reminded me how a user needs to be viewing the forum in order for Scheduled Tasks to execute, I decided to generate $cronimage in my site-wide header (not present on my directory with my vBulletin files) so that Scheduled Tasks hopefully would execute even if nobody is viewing the Forum Index. Here is what I included (community/ is the directory where I have my vBulletin): PHP Code:
Thanks again! |
#7
|
|||
|
|||
It seems right, but to be honest I don't know for sure.
|
#9
|
||||
|
||||
Quote:
Anyways, good to see that the code I added in the header looks OK. Thanks for all the help! |
#10
|
||||
|
||||
Gotcha. Glad to see you found a way to do what you wanted though.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|