Vote #79360
完了Update User#last_login_on only once per minute
0%
説明
On setups where a lot of logins happen (e.g. when heavily using the API with Basic Auth credentials), access to the@ users@ table can get contentioned due to the many parallel write queries to the table during each request as each requests sets the last_login_on column of the user to the current date in @User.try_to_login@. This can result in deadlocks or general long lock waits on the database since all of these update queries will effectively be serialized per user.
By updating the last_login_on column less often, we can drastically reduce this contention. The attached patch implements this by only updating the @last_login_on@ column once per minute.
journals
--------------------------------------------------------------------------------
nice catch!
I'm wondering if something like this could be also applied for
verify_session_token - https://github.com/redmine/redmine/blob/43d9bea7c5da32a99c3ebdb828e23d6a02c31c12/app/models/user.rb#L442
if Rails.application.config.redmine_verify_sessions is enabled, redmine updates user tokens on each request. These updates are at the top or our db monitoring.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
+1
Sometimes I also experience the same problem.
Setting target version to 4.1.0.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Patch committed, thanks.
Pavel Rosický wrote:
> I'm wondering if something like this could be also applied for
> verify_session_token - https://github.com/redmine/redmine/blob/43d9bea7c5da32a99c3ebdb828e23d6a02c31c12/app/models/user.rb#L442
> if Rails.application.config.redmine_verify_sessions is enabled, redmine updates user tokens on each request. These updates are at the top or our db monitoring.
Please fill a separate issue so we can keep track of that.
--------------------------------------------------------------------------------
done #29041
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
related_issues
relates,New,20648,Users' "Last connection" is not updated correctly.
relates,Closed,29041,Update session token only once per minute