Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Hsin-Yu Chien
edx-platform-release
Commits
3db07bca
Commit
3db07bca
authored
12 years ago
by
kimth
Browse files
Options
Downloads
Patches
Plain Diff
Frontend polling rate aware of queue length at time of submission
parent
afd78feb
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
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+13
-3
13 additions, 3 deletions
common/lib/xmodule/xmodule/js/src/capa/display.coffee
with
13 additions
and
3 deletions
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+
13
−
3
View file @
3db07bca
...
...
@@ -35,8 +35,18 @@ class @Problem
if
@
queued_items
.
length
>
0
if
window
.
queuePollerID
# Only one poller 'thread' per Problem
window
.
clearTimeout
(
window
.
queuePollerID
)
window
.
queuePollerID
=
window
.
setTimeout
(
@
poll
,
100
)
queuelen
=
@
get_queuelen
()
window
.
queuePollerID
=
window
.
setTimeout
(
@
poll
,
queuelen
*
10
)
# Retrieves the minimum queue length of all queued items
get_queuelen
:
=>
minlen
=
Infinity
@
queued_items
.
each
(
index
,
qitem
)
->
len
=
parseInt
(
$
.
text
(
qitem
))
if
len
<
minlen
minlen
=
len
return
minlen
poll
:
=>
$
.
postWithPrefix
"
#{
@
url
}
/problem_get"
,
(
response
)
=>
@
queued_items
=
$
(
response
.
html
).
find
(
".xqueue"
)
...
...
@@ -47,7 +57,7 @@ class @Problem
@
bind
()
delete
window
.
queuePollerID
else
# TODO:
D
ynamically adjust
timeout interval
based on
@
queue
d_items.value
# TODO:
Some logic to d
ynamically adjust
polling rate
based on queue
len
window
.
queuePollerID
=
window
.
setTimeout
(
@
poll
,
1000
)
render
:
(
content
)
->
...
...
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