Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
9b274039
Commit
9b274039
authored
Sep 05, 2012
by
Byron Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 749540: Avoid database deadlocks when deleting recent searches
r=dkl, a=LpSolit
parent
bcbdb846
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
Recent.pm
Bugzilla/Search/Recent.pm
+7
-6
No files found.
Bugzilla/Search/Recent.pm
View file @
9b274039
...
...
@@ -54,12 +54,13 @@ sub create {
my
$user_id
=
$search
->
user_id
;
# Enforce there only being SAVE_NUM_SEARCHES per user.
my
$min_id
=
$dbh
->
selectrow_array
(
'SELECT id FROM profile_search WHERE user_id = ? ORDER BY id DESC '
.
$dbh
->
sql_limit
(
1
,
SAVE_NUM_SEARCHES
),
undef
,
$user_id
);
if
(
$min_id
)
{
$dbh
->
do
(
'DELETE FROM profile_search WHERE user_id = ? AND id <= ?'
,
undef
,
(
$user_id
,
$min_id
));
my
@ids
=
@
{
$dbh
->
selectcol_arrayref
(
"SELECT id FROM profile_search WHERE user_id = ? ORDER BY id"
,
undef
,
$user_id
)
};
if
(
scalar
(
@ids
)
>
SAVE_NUM_SEARCHES
)
{
splice
(
@ids
,
-
SAVE_NUM_SEARCHES
);
$dbh
->
do
(
"DELETE FROM profile_search WHERE id IN ("
.
join
(
','
,
@ids
)
.
")"
);
}
$dbh
->
bz_commit_transaction
();
return
$search
;
...
...
Write
Preview
Markdown
is supported
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