Problem/Motivation

GoogleAnalyticsCounterAppManager::gacUpdatePathCounts() calls reportData() but doesn't pass the current timestamp to it. This means in rare circumstances the following can happen:

Steps to reproduce

- Jun 28 23:58:50 cron runs, creates for example 200 fetch queue items, 1 count queue items
- Jun 28 23:59:30 fetch queue item processing starts, 30 seconds to mignight, so about 15 item is processed, they are querying pageviews from last 365 days, so: 2022-06-27 -> 2023-06-27.
- Jun 29 00:00:01 the queue processing will continue until 120 seconds are passed from queue processing start, so about 45 items are processed queried from 2022-06-27 -> 2023-06-27 (request time is still from Jun 28).
- next cron run: Jun 29 00:05:00 (if someone runs cron in 5 minute intervals) about the next 60 fetch queue items are processed but they query pageviews from the last 365 days with different interval: 2022-06-28 -> 2023-06-28 because request time is now Jun 29.

Proposed resolution

Save the very first starting timestamp when GoogleAnalyticsCounterCron creates queue items, so anytime it is processed, it will work with the same parameters and same date ranges.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

kaszarobert created an issue. See original summary.

  • kaszarobert authored 7a720fbf on 4.0.x
    Issue #3371235 by kaszarobert: Fetch queue items could run different...
kaszarobert’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.