Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
9acd68a4
Commit
9acd68a4
authored
Jan 08, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not hold db lock while doing fulltext updates
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
158b9ed1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
weblate/trans/management/commands/update_index.py
weblate/trans/management/commands/update_index.py
+8
-4
No files found.
weblate/trans/management/commands/update_index.py
View file @
9acd68a4
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#
#
from
django.core.management.base
import
BaseCommand
from
django.core.management.base
import
BaseCommand
from
django.db
import
transaction
from
weblate.trans.models
import
IndexUpdate
,
Unit
from
weblate.trans.models
import
IndexUpdate
,
Unit
from
weblate.trans.search
import
update_index
from
weblate.trans.search
import
update_index
from
optparse
import
make_option
from
optparse
import
make_option
...
@@ -43,9 +44,11 @@ class Command(BaseCommand):
...
@@ -43,9 +44,11 @@ class Command(BaseCommand):
source_unit_ids
=
set
()
source_unit_ids
=
set
()
# Grab all updates from the database
# Grab all updates from the database
for
update
in
IndexUpdate
.
objects
.
all
()[:
options
[
'limit'
]].
iterator
():
with
transaction
.
atomic
():
indexupdates
.
add
(
update
.
pk
)
updates
=
IndexUpdate
.
objects
.
all
()
unit_ids
.
add
(
update
.
unit_id
)
for
update
in
updates
[:
options
[
'limit'
]].
iterator
():
indexupdates
.
add
(
update
.
pk
)
unit_ids
.
add
(
update
.
unit_id
)
if
update
.
source
:
if
update
.
source
:
source_unit_ids
.
add
(
update
.
unit_id
)
source_unit_ids
.
add
(
update
.
unit_id
)
...
@@ -62,4 +65,5 @@ class Command(BaseCommand):
...
@@ -62,4 +65,5 @@ class Command(BaseCommand):
update_index
(
units
,
source_units
)
update_index
(
units
,
source_units
)
# Delete processed updates
# Delete processed updates
IndexUpdate
.
objects
.
filter
(
id__in
=
indexupdates
).
delete
()
with
transaction
.
atomic
():
IndexUpdate
.
objects
.
filter
(
id__in
=
indexupdates
).
delete
()
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