Page MenuHomePhabricator

IPInfo logger should queue a logging job instead of writing directly
Closed, ResolvedPublic2 Estimated Story Points

Description

Discovered in QA of T294658: Create a log entry when the RevisionHandler is called. Logging while trying to expand the infobox (and therefore writing a user preference update to the db) results in a 500 error from the ip info api call because of a lock contention (at least in sqlite). Additionally, it's preferred practice to not write on the request [1]. Instead, the logging function should queue up the job and that way callers of the function (T294658: Create a log entry when the RevisionHandler is called and T294657: Create a log entry when the LogHandler is called) can continue to just call the function without worrying about how it's going about logging.

1 https://www.mediawiki.org/wiki/Manual:Job_queue/For_developers#Use_jobs_if_you_need_to_save_data_in_the_context_of_a_GET_request

Event Timeline

Change 759570 had a related patch set uploaded (by STran; author: STran):

[mediawiki/extensions/IPInfo@master] Make LogIPInfoAccessJob

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

ARamirez_WMF set the point value for this task to 2.Feb 8 2022, 5:59 PM

Change 759570 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@master] Make LogIPInfoAccessJob

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

Moving to Done because this is a bit under-the-hood and will be tested via the parent tasks