Page MenuHomePhabricator

ApiQueryGrowthTasks: Refresh TaskSet cache after query
Closed, ResolvedPublic

Description

Currently, calls to the growthtasks API don't result in refreshed TaskSet objects. E.g. calling https://cs.wikipedia.org/w/api.php?action=query&format=json&uselang=en&list=growthtasks&formatversion=2&gttasktypes=image-recommendation multiple times will yield the same items in the result set.

One way to address that is to have the endpoint work similarly to SuggestedEdits module on Special:Homepage: after retrieving the task set object, we use a deferred update to refresh the cached object.

We could also provide a parameter for the API to bypass the cache.

Note that clients which want to provide psuedo pagination of results should use the excludepageids parameter to ensure that subsequent calls to the API don't yield matches with what the client has already seen.

Acceptance Criteria

  1. Should be able to see different results when querying the growthtasks API.
  2. Should be able to bypass the cache with a query parameter with the growthtasks API
Completion checklist

Functionality

  • The patches have been code reviewed and merged
  • The task passes its acceptance criteria

Engineering

  • There are existing and passing unit/integration tests
  • Tests for every involved patch should pass
  • Coverage for every involved project should have improved or stayed the same

Design & QA

  • If the task is UX/Design related: it must be reviewed and approved by the UX/Design team
  • Must be reviewed and approved by Quality Assurance.

Documentation

  • Related and updated documentation done where necessary

Event Timeline

Change 850086 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/GrowthExperiments@master] ApiQueryGrowthTasks: Refresh task set cache after query

https://gerrit.wikimedia.org/r/850086

Change 850414 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/GrowthExperiments@master] ApiQueryGrowthTasks: Allow client to set useCache option

https://gerrit.wikimedia.org/r/850414

If we proceed with this patch, I think we should also disable anonymous user access to this API endpoint; the cache mechanism doesn't really make sense for an anonymous user request.

Change 850414 abandoned by Kosta Harlan:

[mediawiki/extensions/GrowthExperiments@master] ApiQueryGrowthTasks: Allow client to set useCache option

Reason:

I don't think we need this patch after all. If someone thinks otherwise, please say so!

https://gerrit.wikimedia.org/r/850414

Change 850086 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] ApiQueryGrowthTasks: Refresh task set cache after query

https://gerrit.wikimedia.org/r/850086