Support » Plugin: Amazon Associates Link Builder » fixed the timeouts by changing a couple of constant declarations

  • After a few others and I got into these horrendous API blocks for too many API calls, I did a little digging.

    My wp_options table was filling up with thousands and thousands of API batch call records. To the point where I had more than half a GB in that one table alone.

    Initially I just started deleting thousands of records, then I dug a little deeper.

    In the source to this plugin is a source file called: ./constants/cron_constants.php

    Inside that file I found a mixture of constants referring to various time periods expressed as both numeric values in seconds, and as “15 minutes”.

    Changing two of the constants which were ‘value’ to their equivalent in seconds.

    These are the two I changed:

    * GHL – 25 minutes in seconds = 1500 – use seconds, not english representation
    // const CACHE_REFRESH_AGE = ’25 MINUTE’;
    const CACHE_REFRESH_AGE = ‘1500’;

    * GHL – 24 hours in seconds = 86400 – use seconds, not english representation
    // const CACHE_EVICT_AGE = ’24 HOUR’;
    const CACHE_EVICT_AGE = ‘86400’;

    Voila – plugin is back to behaving and the wp_options table is no longer a mess full of extra cache batch rows.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi Greg,

    All right?
    Thank you so much for your post. I have the same problem as yours and I will make these changes. Just would like to confirm. Where I read

    const CACHE_REFRESH_AGE = ’25 MINUTE ‘; I will change to
    const CACHE_REFRESH_AGE = ‘1500’;

    and where I read

    const CACHE_EVICT_AGE = ’24 HOUR ‘; I will switch to
    const CACHE_EVICT_AGE = ‘86400’;

    Is that all I need to do?

    yes – my code is full of comments – you have it correct. Those lines should fix the problems.

    As others mentioned in another topic, those constants are eventually used into SQL queries so are okay.

    You can just do a search-in-files form your preferred editor/IDE to find out yourself.

    WHERElast_updated_time< DATE_SUB(CURRENT_TIMESTAMP(), INTERVAL " . Cron_Constants::CACHE_REFRESH_AGE . ")

    so, the final resulting query above when says INTERVAL 25 MINUTE is okay in mysql.

    so, unless you maybe change the cache time by rising those values, your fix shouldn’t have any effect, or worse, you added a bug because you end up by omitting the UNIT of time in the query and as far as I know, you can’t do that:
    INTERVAL expr unit

    I have got the same problem and tried to change the code as per your instructions. But no Use in my case and getting the same error code in link builder. Please help me! Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘fixed the timeouts by changing a couple of constant declarations’ is closed to new replies.