Posted: December 16, 2022 at 1:28 pm
Followup to this thread originally posted: So again, we have cron disabled, but we run it manually via a curl call every 15 minutes via a Linux cron job. Will that work for upcoming event notifications or not? Clearly, it works for some, as I can see that some reminder emails are being generated and sent. What happens when a transaction contains multiple registrations to multiple events on different days and times? Will each registration generate an upcoming reminder email, or only for the first event in that list of registrations? I can’t figure out why some upcoming notification messages aren’t generated while others are despite the events being configured properly to use the correct automated upcoming event template. If we set “Generate and send all messages:” to “On the same request”, will the automated upcoming event notification plugin still work? I’m guessing it won’t? So yes, the inefficient way cron is run via WordPress is disabled, but we run it manually every 15 minutes. It appears to me this should work, as there’s a 30 minute flex window for the queue generation of messages for upcoming? |
|
I was looking into this further, and it looks like one of the problems is with the command handler itself? UpcomingEventNotificationsCommandHandler.php line 198: date(EE_Datetime_Field::mysql_timestamp_format, $this->getStartTimeForQuery()), When the Isn’t this a problem that would cause some events to be missed by automated upcoming event notifications? |
|
Hi there, So I’ll address your question related to the code first:
No, it wouldn’t cause the query to ‘miss’ events, what it could do is shift the time for that query but they still wouldn’t be missed. As long as the above conversion happens with every query it will shift the times in which the query would pull the events in but still trigger for them. Here is
Now,
So that’s basically saying the current time + X days (set in the template) + cron_buffer The buffer for upcoming queries is set to use a default of ‘Every 3 hours’, then we add on 30mins to that just in case someone has changed the above to be 0 (its filtered) and we need a value. So for the above the start value output by date would be something like:
End:
(That is with a threshold of 1 day and default buffer) We use the buffer because we can’t rely on WP_CRON to be consistent enough to say for sure it will trigger the messages on the day it should, so we extend the query to allow for that. However, your setup with using an actual cron removes that inconsistency, it runs every 15 mins so even with the conversion the query would run and trigger the notifications. Now I’ll move on to your other questions:
Which message type are you using for these? The upcoming Event notification will trigger emails for the first DateTime in an event only. The upcoming Datetime notification triggers registrations for each Datetime. The query looks for registrations related to either the Event or Datetimes, it does not care about group registrations etc. It pulls in the registrations related to events based on the first DateTimes start date. The Datetime notification pulls in all the datetimes based on the start date and loops over each of those DateTimes to trigger notifications linked to those DateTimes, again it’s not looking for registrations in groups etc, it just pulls in the registrations related to the current DateTime using the DTT_ID value. For each of those, it then sets an extra meta value in the Database to say that the Upcoming notifications have been process for it and the query then skips those next time.
No, the AUEN notifications will not work without that option, but I don’t think changing that setting is going to fix anything here either way.
Using a real cron is absolutely fine, we can’t rely on it because many people can’t/won’t set them up which is why we use WP_CRON and advanced users can option to do the above. |
|
Thanks for the detailed explanation. That was my understanding as well, but considering we create separate events with a single date time, I don’t understand why some reminder emails are skipped for some of our events. They just never are generated or queued in the message system… We have the same event happen during multiple dates and times, but we create separate event entries when that happens. Still have not found out why some are skipped and out of ideas as to where to look. |
|
^^ Where should I look to see this? If an automated upcoming event notification failed to generate the message or failed for some reason, would it be logged anywhere? Working with post ID, how would see if there are any failed messages for that event? |
|
Anything else helpful you can think of I should look at to try to track this down further? |
|
Ok, so I dug into this some more, and I can see the following: SELECT * FROM For 81424, the EXM_value column is set to NULL. 81423 had no notification emails sent out while 81424 did. So, from that, it looks like the events that successfully processed the upcoming event notification can be seen as follows: SELECT * FROM post id is OBJ_ID… so then, the question remains, why was 81423 skipped? It’s start date was 8.5 hours after 81424, and it’s configured the same way to use the same notification email and threshold… |
|
Does this notification process use a lot of RAM and execution time? I have limited the max memory wordpress can use (256MB / 512MB) and max input variables (3000) in the php.ini etc… wondering if any of that may cause an issue… I did see there’s a batching option, which I’m going to give a try and set to 5 rather than 150:
Not sure if that will help, but I cannot figure out why some of these items are skipped. When running the event handler SQL query manually, all seemed ok, so I really don’t get it! 🙁 |
|
It depends on how many registrations it need to process at once. How many registrations are on these events?
That’s a REALLY low number for batching, maybe 50?
Yeah, this is an odd issue and its going to be tricky to troubleshoot, especially with no errors to work from. To clarify, which SQL query are you referring to above? I assume in the message queue you don’t see any failed or waiting to generate/send messages for these events right? It sounds like you’ve checked this already from the above but I’m just double-checking. |
|
I figured it out. I’m so sorry to have bothered you over this since it’s my fault. In the _duplicate_event function in ee-core, I had modified the duplicate event function to also duplicate the postmeta and esp_extra_meta values from the original event that is cloned. This maintained some custom meta attributes that are annoying to set / reset and also kept the waitlist settings from the original event. However, it had the unintentional side-effect of also cloning the flag that claims the automated upcoming email notifications had already been processed. So, basically, I changed my queries to grab only the specific keys I want to duplicate to prevent this issue moving forward: $post_meta_infos = $wpdb->get_results(“SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$origID AND meta_key IN (‘attribute_link_to_class_details_page’)”); Sorry about that. There is no issue with the upcoming event notification code! |
|
Oh, nice sleuthing and nice find! I’m glad you figured it out 🙂 |
|
The support post ‘RE: Automated Upcoming Event Notification Messages Only Generate for Some Events’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.