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
562a8f85
Commit
562a8f85
authored
Jun 04, 2019
by
Kazuhiko Shiozaki
Committed by
Kazuhiko Shiozaki
Jan 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMFActivity: unhardcode -2 and -10.
parent
2419299d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
product/CMFActivity/Activity/SQLBase.py
product/CMFActivity/Activity/SQLBase.py
+7
-5
product/CMFActivity/tests/testCMFActivity.py
product/CMFActivity/tests/testCMFActivity.py
+1
-1
No files found.
product/CMFActivity/Activity/SQLBase.py
View file @
562a8f85
...
...
@@ -49,6 +49,7 @@ MAX_VALIDATED_LIMIT = 1000
# Read this many messages to validate.
READ_MESSAGE_LIMIT
=
1000
INVOKE_ERROR_STATE
=
-
2
DEPENDENCY_IGNORED_ERROR_STATE
=
-
10
# Activity uids are stored as 64 bits unsigned integers.
# No need to depend on a database that supports unsigned integers.
# Numbers are far big enough without using the MSb. Assuming a busy activity
...
...
@@ -281,17 +282,17 @@ CREATE TABLE %s (
for
line
in
result
]
def
countMessageSQL
(
self
,
quote
,
**
kw
):
return
"SELECT count(*) FROM %s WHERE processing_node >
-10
AND %s"
%
(
self
.
sql_table
,
" AND "
.
join
(
return
"SELECT count(*) FROM %s WHERE processing_node >
%d
AND %s"
%
(
self
.
sql_table
,
DEPENDENCY_IGNORED_ERROR_STATE
,
" AND "
.
join
(
sqltest_dict
[
k
](
v
,
quote
)
for
(
k
,
v
)
in
kw
.
iteritems
()
if
v
)
or
"1"
)
def
hasActivitySQL
(
self
,
quote
,
only_valid
=
False
,
only_invalid
=
False
,
**
kw
):
where
=
[
sqltest_dict
[
k
](
v
,
quote
)
for
(
k
,
v
)
in
kw
.
iteritems
()
if
v
]
if
only_valid
:
where
.
append
(
'processing_node >
-2'
)
where
.
append
(
'processing_node >
%d'
%
INVOKE_ERROR_STATE
)
if
only_invalid
:
where
.
append
(
'processing_node <
-1'
)
where
.
append
(
'processing_node <
= %d'
%
INVOKE_ERROR_STATE
)
return
"SELECT 1 FROM %s WHERE %s LIMIT 1"
%
(
self
.
sql_table
,
" AND "
.
join
(
where
)
or
"1"
)
...
...
@@ -347,8 +348,9 @@ CREATE TABLE %s (
if
validate_list
:
return
(
"SELECT '%s' as activity, uid, date, processing_node,"
" priority, group_method_id, message FROM %s"
" WHERE processing_node >
-10
AND (%s) LIMIT %s"
%
(
" WHERE processing_node >
%d
AND (%s) LIMIT %s"
%
(
type
(
self
).
__name__
,
self
.
sql_table
,
DEPENDENCY_IGNORED_ERROR_STATE
,
' OR '
.
join
(
validate_list
),
READ_MESSAGE_LIMIT
if
same_queue
else
1
))
...
...
product/CMFActivity/tests/testCMFActivity.py
View file @
562a8f85
...
...
@@ -1176,7 +1176,7 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
self
.
flushAllActivities
(
silent
=
1
,
loop_size
=
100
)
message
,
=
activity_tool
.
getMessageList
(
activity
=
activity
,
method_id
=
'failingMethod'
)
self
.
assertEqual
(
message
.
processing_node
,
-
2
)
self
.
assertEqual
(
message
.
processing_node
,
INVOKE_ERROR_STATE
)
self
.
assertTrue
(
message
.
retry
)
activity_tool
.
manageDelete
(
message
.
uid
,
activity
)
self
.
commit
()
...
...
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