Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
772a2d39
Commit
772a2d39
authored
Jul 23, 2007
by
Dries
Browse files
- Patch
#40545
by Moshe: reduces contention in the users table.
parent
837350ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/session.inc
View file @
772a2d39
...
...
@@ -75,8 +75,9 @@ function sess_write($key, $value) {
else
{
db_query
(
"UPDATE
{
sessions
}
SET uid = %d, cache = %d, hostname = '%s', session = '%s', timestamp = %d WHERE sid = '%s'"
,
$user
->
uid
,
isset
(
$user
->
cache
)
?
$user
->
cache
:
''
,
ip_address
(),
$value
,
time
(),
$key
);
// TODO: this can be an expensive query. Perhaps only execute it every x minutes. Requires investigation into cache expiration.
if
(
$user
->
uid
)
{
// Last access time is updated no more frequently than once every 180 seconds.
// This reduces contention in the users table.
if
(
$user
->
uid
&&
time
()
-
$user
->
access
>
variable_get
(
'session_write_interval'
,
180
))
{
db_query
(
"UPDATE
{
users
}
SET access = %d WHERE uid = %d"
,
time
(),
$user
->
uid
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment