dashed-slug.net › Forums › Airdrop extension support › Cron
Tagged: cron, start time, timezone
- This topic has 11 replies, 2 voices, and was last updated 4 years, 11 months ago by
Anonymous.
-
AuthorPosts
-
September 5, 2019 at 10:10 am #6872
Anonymous
InactiveHi Alex,
First of all thank you for this great release.
I installed it and made some ardrops to see how it works, specially the recurring ones.
For non recurring ardrops, fine. For recurring ones something strange happens, and I hope you can give me some guidance.
Yesterday I created 2 ardps post, one for a custom points and another for a coin. I have schedulled them to launch at the time when I created them, but nothing happened. This morning, checking again, I found that both have runned, but I think with 2 hours of delay. One of them it was schedulled to finnish at 1:00 and found in Transactions the last ardrop finnished at 3:00.
I checked again, switching my local time but nothing.
The adapter is responding, there is sufficient balances for the ardps.
Please could you have a look?
Thank you
September 5, 2019 at 10:46 am #6876alexg
KeymasterHello,
This is to be expected. While the site receives constant traffic, the scheduling algorithm has only one or two minutes of delay. If your site does not receive traffic, the transactions will happen later, but they will go through because everything is designed to be asynchronous. If you need more accuracy you could setup an actual cron trigger which will force the site to run more often.
I have also made sure to take timezones into account. Can you check that you have set the correct timezone in WordPress?
with regards
September 5, 2019 at 9:09 pm #6884Anonymous
InactiveYes, I have to agree that there is alñost no traffic for the site I am refering to. But don’t you think that the gap is too much? For example, today I edited an ardrp to run today from 9:33 AM to 17:30 PM, and now at 23:05 PM is still running.
You mention a serer cron triger, how can I setup it?
Regarding timezones, it is the first thing I checked when I observed that delay, but according to what I can observe, it is correct. I have set on my wp UTC+2. That is whay I asked if I have set an end airdrp time, why it is still running after the limit time?
Thanks Alex,
September 6, 2019 at 12:08 pm #6890alexg
KeymasterHello,
Thank you for the additional info.
If there is no traffic at all, then WordPress does not run so nothing can happen. Setting up a manual cron trigger is something that is also discussed in the plugin’s cron job settings screen. And there are multiple articles about it.
However I am not sure this is the cause of your issue. It sounds very suspicious that there was exactly a two hour delay both on start and finish, while your timezone is +2.
This is something that I have tested extensively on my machine, but it is still possible that there is a mismatch between your WordPress timezone setting and the PHP timezone setting. I will investigate and if this is the case I will patch the code to account for this and will inform you again on this thread soon.
In the meantime, if you want, check your server’s PHP settings to see what the timezone is set to. For example, see this article: https://www.inmotionhosting.com/support/website/php/setting-the-timezone-for-php-in-the-phpini-file
with regards
September 6, 2019 at 3:22 pm #6892alexg
KeymasterHello again,
After testing extensively I can confirm the following:
The PHP ini settings don’t matter. You can set the correct timezone in the WordPress settings, then set your airdrop times relative to that timezone. It should work no matter what.
If you have created your airdrop entry before setting the timezone, it’s best to create a new airdrop from scratch just to be on the safe side.
Also, if you are in a position to easily test on a different server, please do so.
This is again a case of “it works on my machine”. I am out of ideas right now, so I’d recommend that you set up an external cron to trigger your WordPress every few minutes. I will investigate your other requests regarding WCMp.
with regards
September 8, 2019 at 9:05 pm #6899Anonymous
InactiveHello Alex,
I followed your advice, creating from scratch different ardrps with different settings and I found:
1. I checked the time setting of my server and it is UTC (checked from wdfence settings and the debug file). So I launched an ardrop setting the server time, not wp time, and in fact it starts with server time, and not the wp time, which is UTC+2. That is is why I was founding the 2 hours delay.
2. I have a doubt qbout the cron. For wallts in general I have an external cron running (setting to “never” in wallets admin backnd). The external cron job does not work for airdrps?… installing wpcrontrol extension, I forced some ardrops to run but no success. Setting an internal cron for every 5 minutes, I found that the task was schedulled for every minute.
3. Also I found that when I setup an airdrop for specific roles, it does not work at all, even changing the time, and it stays in active mode even after the end time. In the debug file I found:
[08-Sep-2019 17:17:42 UTC] WordPress database error Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_unicode_520_ci,IMPLICIT) for operation ‘=’ for query SELECT wp_users.* FROM wp_users INNER JOIN wp_usermeta ON ( wp_users.ID = wp_usermeta.user_id ) WHERE 1=1 AND (
(
( wp_usermeta.meta_key = ‘wp_capabilities’ AND wp_usermeta.meta_value LIKE ‘%\”Client\”%’ )
)
) ANDwp_users
.ID
NOT IN (SELECTuser_id
FROMwp_usermeta
WHERE (meta_key
= ’email_dig_receive_enabled’ ANDmeta_value
= 0) OR (meta_key
= ’email_dig_sent’ ANDmeta_value
= 1) GROUP BYuser_id
) ANDwp_users
.user_email
NOT IN (SELECTedl_recipient
FROMwp_email_dig_log
WHEREedl_sent
LIKE ‘%2019-09-08%’ ) ANDwp_users
.user_email
NOT IN (SELECTmail_recipient
FROMwp_mail_queue
WHEREmail_subject
= ‘Your’ ) ANDwp_users
.ID
IN (SELECTusr_id
FROMwp_users
WHEREusr_last_activity
< ‘2019-09-07’) ORDER BY user_login ASC made by do_action_ref_array(‘wallets_airdrop_cron_action’), WP_Hook->do_action, WP_Hook->apply_filters, Dashed_Slug_Wallets_Airdrop_Post_Type->cron, Dashed_Slug_Wallets_Airdrop_Post_Type->run_airdrop_once, get_users, WP_User_Query->__construct, WP_User_Query->queryThank you
September 9, 2019 at 6:21 am #6900alexg
KeymasterHello,
1. If I understood you correctly, you had set the WP server time to UTC and therefore the airdrops all run on UTC time as expected. Does this mean that when you switch the site-wide timezone setting to your timezone UTC+2, the airdrops now run on UTC+2? (This is how the plugin was designed and tested.)
2. For this extension I have implemented a separate scheduler that is independent from all the other cron jobs. If you create an airdrop that is applicable in the past, then it will run once every minute until it catches up, but is guaranteed to eventually pay out all the airdrops corresponding to the time period you specified. I will make this clearer in the product description. Thank you.
3. The SQL problem you describe is not related to this plugin. Instead it seems different DB tables are created with different collations, which is unusual. Did you manipulate tables recently, such as importing or exporting tables? You should make sure that all WordPress tables have the same collation. This is the same issue reported here: https://wpml.org/forums/topic/wp4-6-0-illegal-mix-of-collations-when-using-utf8mb4_unicode_520_ci/ and here: https://www.satollo.net/query-error-illegal-mix-of-collations-utf8mb4_unicode_ciimplicit-and-utf8mb4_unicode_520_ciimplicit
The solution is to force all your tables to have the same collation, for example:
utf8mb4_unicode_ci
To do this automatically you can try this tool (I haven’t tested it) https://wordpress.org/plugins/database-collation-fix/ or you can manually modify the collations from your SQL console or phpMySQL.
Whatever you do, back up your database first.
with regards
September 9, 2019 at 8:33 am #6904Anonymous
InactiveAlex,
1. No. What I mean is that my wpinstall is at UTC+2, and the server at UTC. For example: in order to setup an ardrp now to run at 10:30 (UTC+2), I have to put the start at 8:30 (UTC). I just made another test and it is running according to UTC (server time).
2. Is there a way to setup an external cron jon for ardrps, similarly like for wallts?
3. I did not checked yet, but do you think this is the problem why it does not work for specific roles?
Thank you
Best regards
September 9, 2019 at 9:26 am #6909alexg
KeymasterHello,
1. I am not sure why this is the case. Is it possible for you to set the server time to your local timezone? What happens then?
2. If you have already set up a trigger for the main cron job task, then that is enough. As long as WordPress is being triggered then the Airdrop cron mechanism will also run. It will execute any past (pending) airdrops, at most one per minute, then it will check for any future airdrops again once per minute and will execute any airdrops whose time has come.
3. Regarding the issue with non-matching collations, this is something that you should address before anything else. It is very likely that it causes several user-related issues and yes, it is also likely that it is what’s preventing you from running airdrops for specific roles. The issue might have been created by a plugin that created tables manually without first checking the result of
$wpdb->get_charset_collate();
(https://developer.wordpress.org/reference/classes/wpdb/get_charset_collate/)with regards
September 20, 2019 at 12:24 pm #6985Anonymous
InactiveHi Alex,
After the last release, I turned back to ardrp to see if the issue of Time setting was fixed. So, returning to the issue 1:
1. I scheduled a new airdp, starting at 10:55 AM to 11:10 AM, as you can see:
https://www.dropbox.com/s/xpoiw079kwyp7kn/Capture%20I%20-%20Airdrop%20-%20Backend.PNG?dl=0
Even if in my backend was the start at 10:55 AM, it started 2 hours later, finishing at 13:11 PM, as you can see from transactions:
https://www.dropbox.com/s/tzvqz3ehqh63k3k/Capture%20II%20-%20Transactions%20-%20Backend.PNG?dl=0
In frontend, it shows also UTC+2:
https://www.dropbox.com/s/53tkcdo63t2n6io/Capture%20III%20-%20Airdrop%20-%20Frontend.PNG?dl=0
My wp is at UTC+2, my OS is at UTC+2 and my server is at UTC as I could verify. There is a mix of timezone settings.
It is not a big issue, but do you recommend me just to setup my server time at UTC+2? or maybe is some isue somewhere?
Thank you Alex
Best regards
September 23, 2019 at 8:40 am #6997alexg
KeymasterHello,
Thank you for the detailed info.
I definitely do NOT recommend that you change the server time. This can create problems elsewhere.
I will review the information you gave me and try to think of something, as soon as I can.
In any case, do not change the server time.
with regards
September 23, 2019 at 10:21 am #7001Anonymous
InactiveHi Alex,
OK, I will follow your advice.
Thanks for checking (when possible), please let me knou if you find something.
Best regards
-
AuthorPosts
- You must be logged in to reply to this topic.