Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
1c4151df
Commit
1c4151df
authored
Oct 04, 2017
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQLCatalog: Use _local_clear_reserved_time as global variable instead of class variable
Also, do some trivial cleanup
parent
19c72d89
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
product/ZSQLCatalog/SQLCatalog.py
product/ZSQLCatalog/SQLCatalog.py
+7
-9
No files found.
product/ZSQLCatalog/SQLCatalog.py
View file @
1c4151df
...
...
@@ -155,9 +155,13 @@ manage_addSQLCatalogForm = DTMLFile('dtml/addSQLCatalog',globals())
# global_uid_buffer_dict[catalog_path][thread_id] = UidBuffer
global_uid_buffer_dict
=
{}
# These are global variables on memory, so shared only by threads in the same Zope instance.
# This is used for exclusive access to the list of reserved uids.
global_reserved_uid_lock
=
allocate_lock
()
# This is set to the time when reserved uids are cleared in this Zope instance.
global_clear_reserved_time
=
None
def
manage_addSQLCatalog
(
self
,
id
,
title
,
vocab_id
=
'create_default_catalog_'
,
# vocab_id is a strange name - not abbreviation
REQUEST
=
None
):
...
...
@@ -636,10 +640,6 @@ class Catalog(Folder,
# in BTrees.Length, this does not generate conflict errors.
_max_uid
=
None
# These are class variable on memory, so shared only by threads in the same Zope instance.
# This is set to the time when reserved uids are cleared in this Zope instance.
_local_clear_reserved_time
=
None
# This is an instance id which specifies who owns which reserved uids.
_instance_id
=
getattr
(
getConfiguration
(),
'instance_id'
,
None
)
...
...
@@ -1205,7 +1205,6 @@ class Catalog(Folder,
security
.
declarePrivate
(
'getUIDBuffer'
)
def
getUIDBuffer
(
self
,
force_new_buffer
=
False
):
klass
=
self
.
__class__
assert
global_reserved_uid_lock
.
locked
()
assert
getattr
(
self
,
'aq_base'
,
None
)
is
not
None
instance_key
=
self
.
getPhysicalPath
()
...
...
@@ -1226,13 +1225,13 @@ class Catalog(Folder,
"""
Produces reserved uids in advance
"""
klass
=
self
.
__class__
global
global_clear_reserved_time
assert
global_reserved_uid_lock
.
locked
()
# This checks if the list of local reserved uids was cleared after clearReserved
# had been called.
force_new_buffer
=
(
klass
.
_loc
al_clear_reserved_time
!=
self
.
_last_clear_reserved_time
)
force_new_buffer
=
(
glob
al_clear_reserved_time
!=
self
.
_last_clear_reserved_time
)
uid_buffer
=
self
.
getUIDBuffer
(
force_new_buffer
=
force_new_buffer
)
klass
.
_loc
al_clear_reserved_time
=
self
.
_last_clear_reserved_time
glob
al_clear_reserved_time
=
self
.
_last_clear_reserved_time
if
len
(
uid_buffer
)
==
0
:
id_tool
=
getattr
(
self
.
getPortalObject
(),
'portal_ids'
,
None
)
if
id_tool
is
not
None
:
...
...
@@ -1318,7 +1317,6 @@ class Catalog(Folder,
if
not
self
.
getPortalObject
().
isIndexable
():
return
None
klass
=
self
.
__class__
with
global_reserved_uid_lock
:
self
.
produceUid
()
uid_buffer
=
self
.
getUIDBuffer
()
...
...
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