Open extra topbar

Cron

If you are new here, please see some information on how to ask for support. Thank you!

Cron

This topic contains 8 replies, has 2 voices, and was last updated by  alexg 6 days, 13 hours ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #6872

    bigblue
    Participant

    Hi 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

    #6876

    alexg
    Keymaster

    Hello,

    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

    #6884

    bigblue
    Participant

    Yes, 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,

    #6890

    alexg
    Keymaster

    Hello,

    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

    #6892

    alexg
    Keymaster

    Hello 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

    #6899

    bigblue
    Participant

    Hello 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\”%’ )
    )
    ) AND wp_users.ID NOT IN (SELECT user_id FROM wp_usermeta WHERE (meta_key = ’email_dig_receive_enabled’ AND meta_value = 0) OR (meta_key = ’email_dig_sent’ AND meta_value = 1) GROUP BY user_id) AND wp_users.user_email NOT IN (SELECT edl_recipient FROM wp_email_dig_log WHERE edl_sent LIKE ‘%2019-09-08%’ ) AND wp_users.user_email NOT IN (SELECT mail_recipient FROM wp_mail_queue WHERE mail_subject = ‘Your’ ) AND wp_users.ID IN (SELECT usr_id FROM wp_users WHERE usr_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->query

    Thank you

    #6900

    alexg
    Keymaster

    Hello,

    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

    #6904

    bigblue
    Participant

    Alex,

    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

    #6909

    alexg
    Keymaster

    Hello,

    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

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.