mirror of
https://github.com/discourse/discourse.git
synced 2025-03-22 18:15:30 +08:00
FIX: last ip address could point at wrong ip
Due to unicorn env object recycling request.ip could point at the wrong ip address by the time defer block is called. This usually would happen under load. This also avoids keeping the entire request object as referenced by the closure.
This commit is contained in:
parent
23de188f89
commit
1f34f653bf
@ -118,9 +118,11 @@ class Auth::DefaultCurrentUserProvider
|
||||
|
||||
if current_user && should_update_last_seen?
|
||||
u = current_user
|
||||
ip = request.ip
|
||||
|
||||
Scheduler::Defer.later "Updating Last Seen" do
|
||||
u.update_last_seen!
|
||||
u.update_ip_address!(request.ip)
|
||||
u.update_ip_address!(ip)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user