Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stats: Remove state list request persistence. #11580

Merged
merged 2 commits into from
Feb 24, 2017
Merged

Stats: Remove state list request persistence. #11580

merged 2 commits into from
Feb 24, 2017

Conversation

timmyc
Copy link
Contributor

@timmyc timmyc commented Feb 23, 2017

This branch fixes an issue introduced in #11035 that causes a stats page to become "stuck" on an old set of data. The auto-refresh feature introduced in the branch currently persists the state of the state.stats.lists.requests subtree, which allows the status of various stats API requests to be permanently stuck in a pending state.

When a given query for a stats endpoint is set to pending in the state tree, the <QuerySiteStats /> component will not issue any further API requests that match the endpoint/query that is set to pending. As such the only way for a user to fix this problem currently is to delete indexedDB manually, or log out.

It is helpful to reproduce the issue for yourself to properly test out this branch:

To Reproduce The Issue

  • Open a site stats page for today ( DAY )
  • Wait for the next refresh to trigger in 3 minutes, by closely watching the network tab in your dev console. It helps to have a filter set to XHR and “top-posts”

stats_ _trout_bummin_ _wordpress_com

  • Immediately close the browser tab while the requests are in-flight. This will persist the pending state in redux.
  • Reopen the same site stats page. Note that the last updated timestamp is stuck, and if you wait 3 minutes, it will not update

There are other ways to get to this state, but I found the above to be the easiest way to reproduce the problem.

To Test the Fix
Run this branch locally, and follow the same steps. Upon reloading the stats page in the last step, the last updated timestamp should be current, and it should update as expected in 3 minutes

@timmyc timmyc added [Feature] Stats Everything related to our analytics product at /stats/ [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Feb 23, 2017
@timmyc timmyc requested review from youknowriad and aduth February 23, 2017 22:16
@matticbot
Copy link
Contributor

@matticbot matticbot added the [Size] S Small sized issue label Feb 23, 2017
@@ -10,7 +10,7 @@ import { merge, unset } from 'lodash';
import { createReducer } from 'state/utils';
import { isValidStateWithSchema } from 'state/utils';
import { getSerializedStatsQuery } from './utils';
import { itemSchema, requestsSchema } from './schema';
Copy link
Contributor

@aduth aduth Feb 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will want to remove the exported requestsSchema from ./schema since it's no longer used.

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch timmy, Tks. The reason I persisted the resquests is to keep the last update date visible on the page. Since the data is shown (from persisted state), I figured we should also show the date of this data.

What if we keep persistence or tweak the serialize action to drop pending requests? One other option is to separate the date into its own reducer.

@matticbot matticbot added [Size] M Medium sized issue and removed [Size] S Small sized issue labels Feb 24, 2017
@timmyc
Copy link
Contributor Author

timmyc commented Feb 24, 2017

The reason I persisted the resquests is to keep the last update date visible on the page. Since the data is shown (from persisted state), I figured we should also show the date of this data.

I can see the reasoning here, but seems like the latest date will still be shown after the first request to top-posts is complete. In my testing it still felt okay without persistence. This bug is affecting multiple users in production now so I'd rather just remove the persistence and revisit during a future stats iteration.

Removed the schema in 51922c4 @aduth

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚢

@timmyc timmyc merged commit f764c0d into master Feb 24, 2017
@timmyc timmyc deleted the fix/stats/stuck branch February 24, 2017 15:23
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Stats Everything related to our analytics product at /stats/ [Size] M Medium sized issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants