-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(other): db session locking to support exclusive mode #1380
base: master
Are you sure you want to change the base?
Conversation
518c456
to
02ca4ba
Compare
… native file session storage works
02ca4ba
to
2657f72
Compare
lib/session_db.php
Outdated
switch ($this->db_driver) { | ||
case 'mysql': | ||
$query = 'SELECT GET_LOCK(:lock_name, :timeout)'; | ||
$params = [':lock_name' => $lock_name, ':timeout' => $this->lock_timeout]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should implement the lock_timeout in other drivers as well - this is important for concurrent requests. You can use a polling mechanism with intervals of 500ms to 1 second.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kroky I just updated, I just did a test with mysql. I'm waiting to see if there are any corrections from you so far before confirming with pgsql
too but it should work for pgsql
too
scripts/setup_database.php
Outdated
$stmt = "{$create_table} hm_user_session (hm_id varchar(255), data longblob, date timestamp, primary key (hm_id));"; | ||
} elseif($db_driver == 'sqlite') { | ||
//0 means unlocked, 1 means locked | ||
$stmt = "{$create_table} hm_user_session (hm_id varchar(255), data longblob, lock INTEGER DEFAULT 0, date timestamp, primary key (hm_id));"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would existing users update their databases? I think we should introduce some kind of a migration mechanism or handle this in the code.
…etup with column migration logic
4ff8dd5
to
9a6025f
Compare
4f0632b
to
066c003
Compare
…ssion locking and concurrency
066c003
to
fadddc5
Compare
Related task item89272