Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
python-nbxmpp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
8
Issues
8
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gajim
python-nbxmpp
Commits
57a438b2
Commit
57a438b2
authored
Nov 07, 2020
by
Philipp Hörist
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Task: Don’t allow to cancel a finished task
parent
efb63279
Pipeline
#6714
passed with stages
in 30 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
nbxmpp/task.py
nbxmpp/task.py
+3
-3
No files found.
nbxmpp/task.py
View file @
57a438b2
...
...
@@ -137,7 +137,7 @@ class Task:
return
self
.
_state
def
add_done_callback
(
self
,
callback
,
weak
=
True
):
if
self
.
_state
in
(
TaskState
.
FINISHED
,
TaskState
.
CANCELLED
)
:
if
self
.
_state
.
is_finished
or
self
.
_state
.
is_cancelled
:
raise
RuntimeError
(
'Task is finished'
)
if
weak
:
...
...
@@ -169,7 +169,7 @@ class Task:
def
_sub_task_completed
(
self
,
task
):
self
.
_sub_task
=
None
if
self
.
_state
.
is_cancelled
:
if
not
self
.
_state
.
is_running
:
return
result
=
task
.
get_result
()
...
...
@@ -263,7 +263,7 @@ class Task:
self
.
_finalize_context
=
context
def
cancel
(
self
):
if
self
.
_state
.
is_cancelled
:
if
not
self
.
_state
.
is_running
:
return
self
.
_state
=
TaskState
.
CANCELLED
...
...
Philipp Hörist
@lovetox
mentioned in issue
#114 (closed)
·
Nov 07, 2020
mentioned in issue
#114 (closed)
mentioned in issue #114
Toggle commit list
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