mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 16:04:35 +00:00
Reduce CAS errors in ApiEchoMarkSeen
* These tend to log errors many times in a row for the same few users in any given time period. There is probably some usage pattern issue in JS on top of the abuse of preferences for such tracking state. In any case, this should help. Bug: T95839 Change-Id: I4d57b1db43a63300a412a5de220b66081da754f1
This commit is contained in:
parent
d072a9a47b
commit
2a0e98e9a9
9
includes/api/ApiEchoMarkSeen.php
Normal file → Executable file
9
includes/api/ApiEchoMarkSeen.php
Normal file → Executable file
|
@ -11,9 +11,14 @@ class ApiEchoMarkSeen extends ApiBase {
|
|||
$this->dieUsage( 'Login is required', 'login-required' );
|
||||
}
|
||||
|
||||
// Load from the master to reduce CAS errors from high update frequency
|
||||
$u = User::newFromId( $user->getId() );
|
||||
$u->load( User::READ_LATEST );
|
||||
|
||||
$timestamp = wfTimestamp( TS_MW );
|
||||
$user->setOption( 'echo-seen-time', $timestamp );
|
||||
$user->saveSettings();
|
||||
// @TODO: do not abuse user preferences for "last seen"
|
||||
$u->setOption( 'echo-seen-time', $timestamp );
|
||||
$u->saveSettings();
|
||||
|
||||
$this->getResult()->addValue( 'query', $this->getModuleName(), array(
|
||||
'result' => 'success',
|
||||
|
|
Loading…
Reference in a new issue