mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
Also display the time until new work is scheduled after rendering.
(imported from commit 33562f105d5dd6ed81ca60d0517277d908ec2ffd)
This commit is contained in:
@@ -356,13 +356,14 @@ function send_message_ajax(request, success) {
|
||||
});
|
||||
}
|
||||
|
||||
function report_send_time(send_time, receive_time) {
|
||||
function report_send_time(send_time, receive_time, display_time) {
|
||||
$.ajax({
|
||||
dataType: 'json', // This seems to be ignored. We still get back an xhr.
|
||||
url: '/json/report_send_time',
|
||||
type: 'POST',
|
||||
data: {"time": send_time,
|
||||
"received": receive_time}
|
||||
data: {"time": send_time.toString(),
|
||||
"received": receive_time.toString(),
|
||||
"displayed": display_time.toString()}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -389,7 +390,8 @@ function maybe_report_send_times(message_id) {
|
||||
return;
|
||||
}
|
||||
report_send_time(data.send_finished - data.start,
|
||||
data.received - data.start);
|
||||
data.received - data.start,
|
||||
data.displayed - data.start);
|
||||
}
|
||||
|
||||
exports.mark_end_to_end_receive_time = function (message_id) {
|
||||
@@ -400,6 +402,14 @@ exports.mark_end_to_end_receive_time = function (message_id) {
|
||||
maybe_report_send_times(message_id);
|
||||
};
|
||||
|
||||
exports.mark_end_to_end_display_time = function (message_id) {
|
||||
if (exports.send_times_data[message_id] === undefined) {
|
||||
exports.send_times_data[message_id] = {};
|
||||
}
|
||||
exports.send_times_data[message_id].displayed = new Date();
|
||||
maybe_report_send_times(message_id);
|
||||
};
|
||||
|
||||
function process_send_time(message_id, start_time) {
|
||||
var send_finished = new Date();
|
||||
var send_time = (send_finished - start_time);
|
||||
|
||||
@@ -636,6 +636,9 @@ function add_messages(messages, msg_list, messages_are_new) {
|
||||
_.each(messages, function (message) {
|
||||
if (message.sent_by_me) {
|
||||
compose.mark_end_to_end_receive_time(message.id);
|
||||
setTimeout(function () {
|
||||
compose.mark_end_to_end_display_time(message.id);
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1880,10 +1880,12 @@ if not (settings.DEBUG or settings.TEST_SUITE):
|
||||
@has_request_variables
|
||||
def json_report_send_time(request, user_profile,
|
||||
time=REQ(converter=to_non_negative_int),
|
||||
received=REQ(converter=to_non_negative_int, default="(unknown)")):
|
||||
logging.info("End-to-end send time: %dms/%dms (%s)" % (time, received, user_profile.email))
|
||||
received=REQ(converter=to_non_negative_int, default="(unknown)"),
|
||||
displayed=REQ(converter=to_non_negative_int, default="(unknown)")):
|
||||
logging.info("End-to-end send time: %sms/%sms/%sms (%s)" % (time, received, displayed, user_profile.email))
|
||||
statsd.timing("endtoend.send_time.%s" % (statsd_key(user_profile.realm.domain),), time)
|
||||
statsd.timing("endtoend.receive_time.%s" % (statsd_key(user_profile.realm.domain),), received)
|
||||
statsd.timing("endtoend.displayed_time.%s" % (statsd_key(user_profile.realm.domain),), displayed)
|
||||
return json_success()
|
||||
|
||||
@authenticated_json_post_view
|
||||
|
||||
Reference in New Issue
Block a user