Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further performance fixes #5141

Merged
merged 1 commit into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/client/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ var PADDING_BOTTOM = 30
, FOCUS_MIN = 30
;

var loadTime = Date.now();

function init (client, d3, $) {
var chart = { };

Expand Down Expand Up @@ -192,7 +194,9 @@ function init (client, d3, $) {
chart.brush = d3.brushX()
.on('start', brushStarted)
.on('brush', function brush (time) {
client.loadRetroIfNeeded();
// layouting the graph causes a brushed event
// ignore retro data load the first two seconds
if (Date.now() - loadTime > 2000) client.loadRetroIfNeeded();
client.brushed(time);
})
.on('end', brushEnded);
Expand Down
14 changes: 13 additions & 1 deletion lib/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,22 @@ client.load = function load (serverSettings, callback) {
client.ddata.inRetroMode = inRetroMode();
client.ddata.profile = profile;

// retro data only ever contains device statuses
// Cleate a clone of the data for the sandbox given to plugins

var mergedStatuses = client.ddata.devicestatus;

if (client.retro.data) {
mergedStatuses = _.merge({}, client.retro.data.devicestatus, client.ddata.devicestatus);
}

var clonedData = _.clone(client.ddata);
clonedData.devicestatus = mergedStatuses;

client.sbx = sandbox.clientInit(
client.ctx
, new Date(time).getTime() //make sure we send a timestamp
, _.merge({}, client.retro.data || {}, client.ddata)
, clonedData
);

//all enabled plugins get a chance to set properties, even if they aren't shown
Expand Down