Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
3db07bca
Commit
3db07bca
authored
Aug 13, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Frontend polling rate aware of queue length at time of submission
parent
afd78feb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+13
-3
No files found.
common/lib/xmodule/xmodule/js/src/capa/display.coffee
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:
Dynamically adjust timeout interval based on @queued_items.value
# TODO:
Some logic to dynamically adjust polling rate based on queuelen
window
.
queuePollerID
=
window
.
setTimeout
(
@
poll
,
1000
)
render
:
(
content
)
->
...
...
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