Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fairblue
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hosting
chat
fairblue
Commits
156aaa40
Commit
156aaa40
authored
5 years ago
by
Chad Pilkey
Browse files
Options
Downloads
Patches
Plain Diff
harden the cursor streamer emit logic
parent
ce94cd51
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
bigbluebutton-html5/imports/api/cursor/server/handlers/cursorUpdate.js
+19
-23
19 additions, 23 deletions
...-html5/imports/api/cursor/server/handlers/cursorUpdate.js
with
19 additions
and
23 deletions
bigbluebutton-html5/imports/api/cursor/server/handlers/cursorUpdate.js
+
19
−
23
View file @
156aaa40
import
{
check
}
from
'
meteor/check
'
;
import
CursorStreamer
from
'
/imports/api/cursor/server/streamer
'
;
import
Logger
from
'
/imports/startup/server/logger
'
;
import
_
from
'
lodash
'
;
const
{
streamerLog
}
=
Meteor
.
settings
.
private
.
serverLog
;
const
CURSOR_PROCCESS_INTERVAL
=
30
;
let
cursorQueue
=
{};
let
cursorReceiverIsRunning
=
false
;
const
proccess
=
()
=>
{
if
(
!
Object
.
keys
(
cursorQueue
).
length
)
{
cursorReceiverIsRunning
=
false
;
return
;
}
cursorReceiverIsRunning
=
true
;
const
cursorQueue
=
{};
const
proccess
=
_
.
throttle
(()
=>
{
try
{
Object
.
keys
(
cursorQueue
).
forEach
((
meetingId
)
=>
{
CursorStreamer
(
meetingId
).
emit
(
'
message
'
,
{
meetingId
,
cursors
:
cursorQueue
[
meetingId
]
});
try
{
const
cursors
=
cursorQueue
[
meetingId
];
delete
cursorQueue
[
meetingId
];
CursorStreamer
(
meetingId
).
emit
(
'
message
'
,
{
meetingId
,
cursors
});
if
(
streamerLog
)
{
Logger
.
debug
(
`CursorUpdate process for meeting
${
meetingId
}
has finished`
);
}
}
catch
(
error
)
{
Logger
.
error
(
`Error while trying to send cursor streamer data for meeting
${
meetingId
}
.
${
error
}
`
);
}
});
cursorQueue
=
{};
Meteor
.
setTimeout
(
proccess
,
CURSOR_PROCCESS_INTERVAL
);
}
catch
(
error
)
{
Logger
.
error
(
`Error while trying to send cursor streamer data.
${
error
}
`
);
cursorReceiverIsRunning
=
false
;
Logger
.
error
(
`Error while processing cursor queue.
${
error
}
`
);
}
};
}
,
CURSOR_PROCCESS_INTERVAL
)
;
export
default
function
handleCursorUpdate
({
header
,
body
},
meetingId
)
{
const
{
userId
}
=
header
;
...
...
@@ -37,15 +36,12 @@ export default function handleCursorUpdate({ header, body }, meetingId) {
check
(
meetingId
,
String
);
check
(
userId
,
String
);
if
(
!
cursorQueue
.
hasOwnProperty
(
meetingId
)
)
{
if
(
!
cursorQueue
[
meetingId
]
)
{
cursorQueue
[
meetingId
]
=
{};
}
if
(
streamerLog
)
{
Logger
.
debug
(
`CursorUpdate process for meeting
${
meetingId
}
is running:
${
cursorReceiverIsRunning
}
`
);
}
// overwrite since we dont care about the other positions
cursorQueue
[
meetingId
][
userId
]
=
body
;
if
(
!
cursorReceiverIsRunning
)
proccess
();
proccess
();
}
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