Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
fslpy
Commits
e64eb259
Commit
e64eb259
authored
8 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
If async idle loop re-queues a task (with after > 0) it doesn't
immediatelly re-run the idle loop.
parent
c597ad19
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/utils/async.py
+5
-3
5 additions, 3 deletions
fsl/utils/async.py
with
5 additions
and
3 deletions
fsl/utils/async.py
+
5
−
3
View file @
e64eb259
...
@@ -244,8 +244,9 @@ def _wxIdleLoop(ev):
...
@@ -244,8 +244,9 @@ def _wxIdleLoop(ev):
_idleTimer
.
Start
(
_idleCallRate
,
wx
.
TIMER_ONE_SHOT
)
_idleTimer
.
Start
(
_idleCallRate
,
wx
.
TIMER_ONE_SHOT
)
return
return
now
=
time
.
time
()
now
=
time
.
time
()
elapsed
=
now
-
task
.
schedtime
elapsed
=
now
-
task
.
schedtime
queueSizeOffset
=
0
# Has enouggh time elapsed
# Has enouggh time elapsed
# since the task was scheduled?
# since the task was scheduled?
...
@@ -254,6 +255,7 @@ def _wxIdleLoop(ev):
...
@@ -254,6 +255,7 @@ def _wxIdleLoop(ev):
log
.
debug
(
'
Re-queueing function ({}) on wx idle
'
log
.
debug
(
'
Re-queueing function ({}) on wx idle
'
'
loop
'
.
format
(
getattr
(
task
.
task
,
'
__name__
'
,
'
<unknown>
'
)))
'
loop
'
.
format
(
getattr
(
task
.
task
,
'
__name__
'
,
'
<unknown>
'
)))
_idleQueue
.
put_nowait
(
task
)
_idleQueue
.
put_nowait
(
task
)
queueSizeOffset
=
1
# Has the task timed out?
# Has the task timed out?
elif
task
.
timeout
==
0
or
(
elapsed
<
task
.
timeout
):
elif
task
.
timeout
==
0
or
(
elapsed
<
task
.
timeout
):
...
@@ -265,7 +267,7 @@ def _wxIdleLoop(ev):
...
@@ -265,7 +267,7 @@ def _wxIdleLoop(ev):
if
task
.
name
is
not
None
:
if
task
.
name
is
not
None
:
_idleQueueSet
.
discard
(
task
.
name
)
_idleQueueSet
.
discard
(
task
.
name
)
if
_idleQueue
.
qsize
()
>
0
:
if
_idleQueue
.
qsize
()
>
queueSizeOffset
:
ev
.
RequestMore
()
ev
.
RequestMore
()
else
:
else
:
_idleTimer
.
Start
(
_idleCallRate
,
wx
.
TIMER_ONE_SHOT
)
_idleTimer
.
Start
(
_idleCallRate
,
wx
.
TIMER_ONE_SHOT
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment