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
c34d5381
Commit
c34d5381
authored
4 years ago
by
Joao Siebel
Browse files
Options
Downloads
Patches
Plain Diff
Add flag to enable/disable custom heartbeat functions
parent
ba89487d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bigbluebutton-html5/imports/startup/server/index.js
+52
-47
52 additions, 47 deletions
bigbluebutton-html5/imports/startup/server/index.js
bigbluebutton-html5/private/config/settings.yml
+1
-0
1 addition, 0 deletions
bigbluebutton-html5/private/config/settings.yml
with
53 additions
and
47 deletions
bigbluebutton-html5/imports/startup/server/index.js
+
52
−
47
View file @
c34d5381
...
...
@@ -23,60 +23,65 @@ Meteor.startup(() => {
const
CDN_URL
=
APP_CONFIG
.
cdn
;
let
heapDumpMbThreshold
=
100
;
// https://github.com/sockjs/sockjs-node/blob/1ef08901f045aae7b4df0f91ef598d7a11e82897/lib/transport/websocket.js#L74-L82
const
newHeartbeat
=
function
heartbeat
()
{
const
currentTime
=
new
Date
().
getTime
();
// Skipping heartbeat, because websocket is sending data
if
(
currentTime
-
this
.
ws
.
lastSentFrameTimestamp
<
10000
)
{
Logger
.
info
(
'
Skipping heartbeat, because websocket is sending data
'
,
{
currentTime
,
lastSentFrameTimestamp
:
this
.
ws
.
lastSentFrameTimestamp
,
userId
:
this
.
session
.
connection
.
_meteorSession
.
userId
,
});
return
;
}
const
{
customHeartbeat
}
=
APP_CONFIG
;
if
(
customHeartbeat
)
{
Logger
.
warn
(
'
Custom heartbeat functions are enabled
'
);
// https://github.com/sockjs/sockjs-node/blob/1ef08901f045aae7b4df0f91ef598d7a11e82897/lib/transport/websocket.js#L74-L82
const
newHeartbeat
=
function
heartbeat
()
{
const
currentTime
=
new
Date
().
getTime
();
// Skipping heartbeat, because websocket is sending data
if
(
currentTime
-
this
.
ws
.
lastSentFrameTimestamp
<
10000
)
{
Logger
.
info
(
'
Skipping heartbeat, because websocket is sending data
'
,
{
currentTime
,
lastSentFrameTimestamp
:
this
.
ws
.
lastSentFrameTimestamp
,
userId
:
this
.
session
.
connection
.
_meteorSession
.
userId
,
});
return
;
}
const
supportsHeartbeats
=
this
.
ws
.
ping
(
null
,
()
=>
clearTimeout
(
this
.
hto_ref
));
if
(
supportsHeartbeats
)
{
this
.
hto_ref
=
setTimeout
(()
=>
{
Logger
.
info
(
'
Heartbeat timeout
'
,
{
userId
:
this
.
session
.
connection
.
_meteorSession
.
userId
,
sentAt
:
currentTime
,
now
:
new
Date
().
getTime
()
});
},
Meteor
.
server
.
options
.
heartbeatTimeout
);
}
else
{
Logger
.
error
(
'
Unexpected error supportsHeartbeats=false
'
);
}
};
const
supportsHeartbeats
=
this
.
ws
.
ping
(
null
,
()
=>
clearTimeout
(
this
.
hto_ref
));
if
(
supportsHeartbeats
)
{
this
.
hto_ref
=
setTimeout
(()
=>
{
Logger
.
info
(
'
Heartbeat timeout
'
,
{
userId
:
this
.
session
.
connection
.
_meteorSession
.
userId
,
sentAt
:
currentTime
,
now
:
new
Date
().
getTime
()
});
},
Meteor
.
server
.
options
.
heartbeatTimeout
);
}
else
{
Logger
.
error
(
'
Unexpected error supportsHeartbeats=false
'
);
}
};
// https://github.com/davhani/hagty/blob/6a5c78e9ae5a5e4ade03e747fb4cc8ea2df4be0c/faye-websocket/lib/faye/websocket/api.js#L84-L88
const
newSend
=
function
send
(
data
)
{
this
.
lastSentFrameTimestamp
=
new
Date
().
getTime
();
// https://github.com/davhani/hagty/blob/6a5c78e9ae5a5e4ade03e747fb4cc8ea2df4be0c/faye-websocket/lib/faye/websocket/api.js#L84-L88
const
newSend
=
function
send
(
data
)
{
this
.
lastSentFrameTimestamp
=
new
Date
().
getTime
();
// Call https://github.com/meteor/meteor/blob/1e7e56eec8414093cd0c1c70750b894069fc972a/packages/ddp-common/heartbeat.js#L80-L88
this
.
meteorHeartbeat
.
_seenPacket
=
true
;
if
(
this
.
meteorHeartbeat
.
_heartbeatTimeoutHandle
)
{
this
.
meteorHeartbeat
.
_clearHeartbeatTimeoutTimer
();
}
// Call https://github.com/meteor/meteor/blob/1e7e56eec8414093cd0c1c70750b894069fc972a/packages/ddp-common/heartbeat.js#L80-L88
this
.
meteorHeartbeat
.
_seenPacket
=
true
;
if
(
this
.
meteorHeartbeat
.
_heartbeatTimeoutHandle
)
{
this
.
meteorHeartbeat
.
_clearHeartbeatTimeoutTimer
();
}
if
(
this
.
readyState
>
1
/* API.OPEN = 1 */
)
return
false
;
if
(
!
(
data
instanceof
Buffer
))
data
=
String
(
data
);
return
this
.
_driver
.
messages
.
write
(
data
);
};
if
(
this
.
readyState
>
1
/* API.OPEN = 1 */
)
return
false
;
if
(
!
(
data
instanceof
Buffer
))
data
=
String
(
data
);
return
this
.
_driver
.
messages
.
write
(
data
);
};
Meteor
.
setInterval
(()
=>
{
for
(
const
session
of
Meteor
.
server
.
sessions
.
values
())
{
const
{
socket
}
=
session
;
const
recv
=
socket
.
_session
.
recv
;
Meteor
.
setInterval
(()
=>
{
for
(
const
session
of
Meteor
.
server
.
sessions
.
values
())
{
const
{
socket
}
=
session
;
const
recv
=
socket
.
_session
.
recv
;
if
(
session
.
bbbFixApplied
||
!
recv
||
!
recv
.
ws
)
{
continue
;
}
if
(
session
.
bbbFixApplied
||
!
recv
||
!
recv
.
ws
)
{
continue
;
}
recv
.
ws
.
meteorHeartbeat
=
session
.
heartbeat
;
recv
.
__proto__
.
heartbeat
=
newHeartbeat
;
recv
.
ws
.
__proto__
.
send
=
newSend
;
session
.
bbbFixApplied
=
true
;
}
},
5000
);
recv
.
ws
.
meteorHeartbeat
=
session
.
heartbeat
;
recv
.
__proto__
.
heartbeat
=
newHeartbeat
;
recv
.
ws
.
__proto__
.
send
=
newSend
;
session
.
bbbFixApplied
=
true
;
}
},
5000
);
}
const
memoryMonitoringSettings
=
Meteor
.
settings
.
private
.
memoryMonitoring
;
if
(
memoryMonitoringSettings
.
stat
.
enabled
)
{
...
...
This diff is collapsed.
Click to expand it.
bigbluebutton-html5/private/config/settings.yml
+
1
−
0
View file @
c34d5381
...
...
@@ -36,6 +36,7 @@ public:
# can generate excessive overhead to the server. We recommend
# this value to be kept under 12.
breakoutRoomLimit
:
8
customHeartbeat
:
false
defaultSettings
:
application
:
animations
:
true
...
...
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