Fetch queue items could run different date range queries, resulting different view count than expected

Created on 29 June 2023, over 1 year ago

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

πŸ› Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia kaszarobert

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024