• Resolved weronikaxx88

    (@weronikaxx88)


    Hello
    I have a problem with importing in cron (woocommerce).
    Support of my hosting, he checked many aspects, but he did not find a solution.
    Cron is not able to complete the entire state imposition and prices. The file has over 4000 records. This can be done from 1000 to 2000 and blocks.
    The following shows the log from the server:

    2019-04-03 05:50:12.091601 [NOTICE] [185.xx.xx.xx:35106] oops! 503 Service Unavailable
    
    2019-04-03 05:50:12.091605 [NOTICE] [185.xx.xx.xx:35106] Content len: 0, Request line: 'GET /wp-cron.php?import_key=xxxxxxxxxxx&import_id=15&action=trigger HTTP/1.1'
    
    2019-04-03 05:50:12.091697 [INFO] [185.xx.xx.xx:35106] abort request..., code: 4 
    
    2019-04-03 06:50:13.083761 [INFO] [185.xx.xx.xx:48172] connection to [uds://tmp/lshttpd/APVH_xxxxxxxxx_Suphp.sock] on request #0, confirmed, 1, associated process: 185594, running: 1, error: Connection reset by peer!
    
    2019-04-03 06:50:13.083824 [NOTICE] [185.xx.xx.xx:48172] oops! 503 Service Unavailable
    
    2019-04-03 06:50:13.083829 [NOTICE] [185.xx.xx.xx:48172] Content len: 0, Request line: 'GET /wp-cron.php?import_key=xxxxxxxxxxx&import_id=15&action=trigger HTTP/1.1'
    
    2019-04-03 06:50:13.083900 [INFO] [185.xx.xx.xx:48172] abort request..., code: 4 
    
    2019-04-03 08:20:13.105353 [INFO] [185.xx.xx.xx:50142] connection to [uds://tmp/lshttpd/APVH_xxxxxxxxx_Suphp.sock] on request #0, confirmed, 1, associated process: 633615, running: 1, error: Connection reset by peer!
    
    2019-04-03 08:20:13.105447 [NOTICE] [185.xx.xx.xx:50142] oops! 503 Service Unavailable
    
    2019-04-03 08:20:13.105452 [NOTICE] [185.xx.xx.xx:50142] Content len: 0, Request line: 'GET /wp-cron.php?import_key=xxxxxxxxxxx&import_id=15&action=processing HTTP/1.1'
    
    2019-04-03 08:20:13.105518 [INFO] [185.xx.xx.xx:50142] abort request..., code: 4 
    
    2019-04-03 08:50:13.104484 [INFO] [185.xx.xx.xx:42194] connection to [uds://tmp/lshttpd/APVH_xxxxxxxxx_Suphp.sock] on request #0, confirmed, 1, associated process: 819173, running: 1, error: Connection reset by peer!
    
    2019-04-03 08:50:13.104718 [NOTICE] [185.xx.xx.xx:42194] oops! 503 Service Unavailable
    
    2019-04-03 08:50:13.104728 [NOTICE] [185.xx.xx.xx:42194] Content len: 0, Request line: 'GET /wp-cron.php?import_key=xxxxxxxxxxx&import_id=15&action=trigger HTTP/1.1'

    I decided to skip this problem to update only published products.
    I have codes, but I do not know why they do not work …

    function do_not_update_if_draft($post_id, $data, $import_id)
    {
        // Check for your import
        if ($import_id == 5) {
            // Check if product is draft
            if ( get_post_status ( $post_id ) == 'draft' ) {
                return false;  
            }
            else {
                return true;
            }
        }
        return false; // this will prevent importing products that are not with import_id = 5
    }
    add_filter('wp_all_import_is_post_to_update', 'do_not_update_if_draft', 10, 3);
    function do_not_update_if_draft($post_id, $data, $import_id)
    {        
            // Check if product is draft
            if ( get_post_status ( $post_id ) == 'draft' ) {
                return false;  
            }
            else {
                return true;
            }
    }
    add_filter('wp_all_import_is_post_to_update', 'do_not_update_if_draft', 10, 3);
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @weronikaxx88

    The following shows the log from the server

    There are a lot of “503 Service Unavailable” errors in there. Your web host couldn’t find what caused these?

    I decided to skip this problem to update only published products. I have codes, but I do not know why they do not work

    The problem is that the Post ID parameter for this hook is actually the second one. The following example snippet should work correctly:

    function do_not_update_if_draft( $continue_import, $post_id, $data, $import_id ) {
        if ( get_post_status ( $post_id ) == 'draft' ) {
            return false;  
        } else {
            return true;
        }
    }
    add_filter( 'wp_all_import_is_post_to_update', 'do_not_update_if_draft', 10, 4 );
    Thread Starter weronikaxx88

    (@weronikaxx88)

    Thank @wpallimport for the code.
    Hosting tested various settings according to the documentation.
    The answer of the hosting is that the script requires more than 300 seconds to be executed, and they can not set more.

    Plugin Author WP All Import

    (@wpallimport)

    Hi @weronikaxx88

    Please try the following:

    • Set the records per iteration down to 1 in the Import Settings: https://d.pr/i/Vakkd3. You can test with a higher number if this works.
    • Set the Cron Processing Time Limit to something like 120 at All Import -> Settings: https://d.pr/i/KYXiRi.
    • Make sure your “processing” cron job is running every 2 minutes.
    Plugin Author WP All Import

    (@wpallimport)

    Hi @weronikaxx88

    I’m marking this as resolved since we have not heard back from you. Let us know if you still have questions about this. Anyone else please open a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘problem with importing in cron’ is closed to new replies.