Comments (8)
Specifically, Cavalcade hooks in at pre_option_cron
and pre_update_option_cron
, which are the low-level option hooks in WordPress. This means that any higher level functions (including wp_get_schedule()
etc) will use this data automatically. You can check out how this works in the connector namespace.
A tell-tale sign that Cavalcade is enabled is that entries in the cron array will have 'schedule' => '__fake_schedule'
. (This is because Cavalcade only stores the interval, not the full schedule ID.) If you're spotting those in the data, then Cavalcade is actually enabled. If not, then Cavalcade isn't enabled.
My guess here is that maybe jobs are being scheduled before Cavalcade is actually loaded. Unless Themosis also has hooks in pre_option_cron
etc then it shouldn't be possible for it to be affecting Cavalcade directly, and it's very unlikely that it would be doing that. The most likely explanation is that Cavalcade isn't loaded when your jobs are being scheduled.
I'd also advise double-checking the database directly (specifically the cavalcade_jobs
table) just to make sure the wp-cli command is actually returning the right thing.
from cavalcade.
Keep in mind that what you're scheduling is the hook name, not the callback. There's no restrictions on the hook name in WP that are relevant here, so my guess would be that you're not hooking into this correctly. The relevant code for WP is in connector/namespace.php, which is called via wp_schedule_event
's update_option
call. It's possible that wp_schedule_event
is returning false for some reason (invalid timestamp, invalid recurrence, or something hooked into schedule_event
)
I'd check the database table (wp_cavalcade_jobs
) directly and see if your job has been scheduled there.
Happy to look further if you want to share your full code for the event hooking, but I don't think this is a core Cavalcade issue. :)
from cavalcade.
Sorry for the delayed reply, been super busy with a deadline.
I've just done some more investigation and it seems that I'm not able to register any cron jobs with Cavalcade enabled. The only jobs that cavalcade jobs
reports are:
+----+------+---------------------------+---------------------+---------------------+---------+
| id | site | hook | start | nextrun | status |
+----+------+---------------------------+---------------------+---------------------+---------+
| 15 | 1 | wp_version_check | 2018-03-04 16:17:12 | 2018-03-05 04:17:12 | waiting |
| 16 | 1 | wp_update_plugins | 2018-03-04 16:17:12 | 2018-03-05 04:17:12 | waiting |
| 17 | 1 | wp_update_themes | 2018-03-04 16:17:12 | 2018-03-05 04:17:12 | waiting |
| 18 | 1 | pj_transient_cleaner | 2018-03-04 16:17:12 | 2018-03-05 16:17:12 | waiting |
| 19 | 1 | wp_scheduled_delete | 2018-03-04 16:17:12 | 2018-03-05 16:17:12 | waiting |
| 20 | 1 | delete_expired_transients | 2018-03-04 16:17:12 | 2018-03-05 16:17:12 | waiting |
+----+------+---------------------------+---------------------+---------------------+---------+
cavalcade log
has no info about the missing cron jobs, neither do the cavalcade db tables.
I have a suspicion that this is a problem related to my setup. I'm using the "Themosis" framework. It seems that when Cavalcade is enabled, the Cavalcade schedule_event()
function isn't called. However, I added some var_dumps to wp-includes/cron.php and I see that my expected jobs are at least received by WP.
So I suppose that Cavalcade isn't properly hooking into when WP is setup as a Themosis project.
I think my code will be too complex to share here, but I'm happy to grant you access to our repo and help you spin up a docker container for our project - assuming you're happy to help debug further?
Edit:
Themosis framework: https://framework.themosis.com
from cavalcade.
Cavalcade hooks in at a deep level in WordPress, so themes shouldn't be able to affect it. I think it's more likely that Cavalcade isn't actually being loaded properly. Are you sure the Cavalcade plugin is enabled?
I can try and find time to look at the repo if you want to give me access, but I can't guarantee any timeframe for doing so. You're best off digging into debugging it further yourself if you can.
from cavalcade.
from cavalcade.
Another thing to mention. When I do wp_get_schedule()
or wp_next_scheduled()
, the jobs which I'm registering, but Cavalcade is missing are returned by WP, so they're getting registered, it seems they just aren't getting 'synced' to Cavalcade.
It's also curious that the pj_transient_cleaner
job (in my earlier post) which Cavalcade does pick up isn't a core WP job, (the rest of the jobs are WP native ones) - so maybe there's a hint for me in there too...
And yep, Cavalcade plugin is enabled in mu-plugins. I've debugged in there to to verify it. Bootstrap creates/populates the tables etc
from cavalcade.
@rmccue Good news, I was able to get the jobs loading by registering them using the 'init' action hook. The jobs are now properly scheduled.
Thanks for your help, much appreciated!
Cheers
from cavalcade.
Fantastic news, thanks for the update!
from cavalcade.
Related Issues (20)
- Cron filters are not registered early enough HOT 3
- --allow-root HOT 3
- Access to wp-cron.php should be disabled when Cavalcade is in use HOT 2
- Issues with the index on `nextrun` HOT 14
- PHP 8.0 composer support
- WordPress 5.7 support HOT 3
- wp_schedule_single_event not executing function when calvacade is running on server but works locally
- Results of get_jobs_by_query can give stale timestamps for recurring jobs
- Existing jobs HOT 2
- Some CRON events are not executed (Large WP Multisite) HOT 10
- Question: How do determine whether Cavalcade is active from other Code? HOT 1
- Cavalcade is not working? HOT 1
- Why does Cavalcade do so much on every page load? HOT 3
- Performance issues if checking for schedules during every page load HOT 11
- Command that takes a job id and sets status to 'failed'
- Quick questions HOT 2
- Possible Wrong Version Display and LOG disabling solution HOT 2
- How to fix Cavalcade? HOT 2
- Add `.gitattributes` file to exclude files not needed in composer installs. HOT 1
- Allow to not replay every missing events HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cavalcade.