• Resolved jkont

    (@jkont)


    Hello CartBounty support team,
    I'm writing to report what appears to be a bug with how CartBounty schedules its recurring Action Scheduler actions on my WooCommerce site.
    Issue summary:
    The cartbounty_sync_hook action is being scheduled and executed twice at exactly the same timestamp, every 5 minutes, 24 hours a day. This results in approximately 288 duplicate executions per day.
    Evidence from my Action Scheduler database:
    In a recent 5-hour analysis window (01:00–06:00 site time), I found:

    114 total cartbounty_sync_hook completed actions
    57 of them were exact duplicates (same scheduled_date_gmt to the second)

    Sample of duplicate entries (each timestamp shows 2 separate action_id rows):
    2026-05-05 01:01:40 → 2 duplicate actions
    2026-05-05 01:06:53 → 2 duplicate actions
    2026-05-05 01:12:38 → 2 duplicate actions
    2026-05-05 01:18:14 → 2 duplicate actions
    2026-05-05 01:23:40 → 2 duplicate actions
    … (pattern continues every ~5 minutes)
    The same pattern is currently visible in my Pending actions queue — two cartbounty_sync_hook rows scheduled for the exact same future timestamp.
    Likely cause:
    This is a known pattern that occurs when as_schedule_recurring_action() is called without the $unique = true parameter (or without an as_unschedule_action() check before re-registering). Each plugin load registers the action again, creating a duplicate. The same bug existed in another plugin I use (Product Feed Pro / AdTribes) and was fixed by adding the unique flag.
    Environment:

    WordPress: 6.9.4
    WooCommerce: 10.7
    CartBounty: 8.10
    PHP: 8.3.30
    HPOS: enabled
    Action Scheduler: bundled with WooCommerce

    Impact:
    While each individual sync is lightweight, running it twice every 5 minutes (288 times/day instead of 144) doubles the database load and CPU usage from this hook. On shared hosting environments this contributes measurably to resource consumption.
    Request:

    Could you confirm whether this is a known issue?
    If yes, is there a fix available or planned?
    In the meantime, is it safe for me to manually unschedule the duplicate using as_unschedule_action() without breaking plugin functionality?

    I'm happy to provide additional logs or run any diagnostic snippet you suggest.
    Thank you for your time,

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Nauriskolats

    (@nauriskolats)

    Hello and thank you for the detailed report — this is extremely helpful, and we really appreciate the time you took to investigate and document the behavior.

    We have not had widespread reports of this issue, but we have seen occasional cases of duplicate scheduled actions. CartBounty does include a check to prevent re-scheduling the same recurring action; however, under certain conditions (for example caching, timing overlaps, or concurrent requests), it appears that duplicate entries can still be created.

    Your analysis regarding how this typically happens with Action Scheduler is correct, and it aligns with what we are seeing.

    You can safely delete both scheduled pending actions. CartBounty will immediately create a new one.

    We will review the scheduling logic again to see if we can make it more robust — for example by enforcing stricter uniqueness or adding an additional validation layer to prevent duplicates from being registered.

    Please let us know if cleaning up the duplicate actions resolves the issue on your end.

    Thanks again for bringing this to our attention.
    Nauris

    Plugin Contributor Nauriskolats

    (@nauriskolats)

    Dear @jkont

    Thank you again for the detailed investigation and for taking the time to report this issue so thoroughly. Reports like yours genuinely help us make CartBounty more stable and efficient for everyone.

    After reviewing the scheduling logic, we were able to confirm the cause of the duplicate cartbounty_sync_hook actions in certain concurrent request environments. We have now implemented a fix to prevent duplicate recurring Action Scheduler events from being created.

    The fix has been included in the latest CartBounty v8.10.1 release, so please update to the newest version. Going forward, new duplicates should no longer occur.

    Thank you very much! 🙂

    Thread Starter jkont

    (@jkont)

    Hello Nauris,

    Thank you for the quick turnaround and for actually shipping a fix — much appreciated.

    I have updated to v8.10.1 and removed the existing duplicate pending actions. The plugin recreated a single clean schedule as expected, and I’ll monitor over the coming days to confirm no new duplicates appear.

    Thanks again for the responsive support and for taking the report seriously.

    Best regards.

    • This reply was modified 2 weeks, 5 days ago by jkont.
    • This reply was modified 2 weeks, 5 days ago by jkont.
Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.