mirror of https://github.com/zulip/zulip.git
Add tools for collecting data on message sending times.
Usage, on the javascript console: > feature_flags.collect_send_times = true; > compose.send_many_messages("test", "test", 3) > compose.send_times_data [47, 99, 48] (imported from commit a2a22eea9bb1bbe24a79ec0453c099dabfc61c19)
This commit is contained in:
parent
724b8e6b8a
commit
52829efe52
|
@ -345,8 +345,11 @@ function send_message_socket(request, success) {
|
|||
});
|
||||
}
|
||||
|
||||
function send_message() {
|
||||
var request = create_message_object();
|
||||
exports.send_times_data = [];
|
||||
function send_message(request) {
|
||||
if (request === undefined) {
|
||||
request = create_message_object();
|
||||
}
|
||||
exports.snapshot_message(request);
|
||||
|
||||
if (request.type === "private") {
|
||||
|
@ -360,6 +363,9 @@ function send_message() {
|
|||
if (feature_flags.log_send_times) {
|
||||
blueslip.log("send time: " + (new Date() - start_time));
|
||||
}
|
||||
if (feature_flags.collect_send_times) {
|
||||
exports.send_times_data.push((new Date() - start_time));
|
||||
}
|
||||
$("#new_message_content").val('').focus();
|
||||
autosize_textarea();
|
||||
$("#send-status").hide(0);
|
||||
|
@ -380,6 +386,34 @@ function send_message() {
|
|||
}
|
||||
}
|
||||
|
||||
// This function is for debugging / data collection only. Arguably it
|
||||
// should live in debug.js, but then it wouldn't be able to call
|
||||
// send_message() directly below.
|
||||
exports.test_send_many_messages = function (stream, subject, count) {
|
||||
var num_sent = 0;
|
||||
|
||||
function do_send_one () {
|
||||
var message = {};
|
||||
num_sent += 1;
|
||||
|
||||
message.type = "stream";
|
||||
message.to = stream;
|
||||
message.subject = subject;
|
||||
message.content = num_sent.toString();
|
||||
message.client = client();
|
||||
|
||||
send_message(message);
|
||||
|
||||
if (num_sent === count) {
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(do_send_one, 1000);
|
||||
}
|
||||
|
||||
do_send_one();
|
||||
};
|
||||
|
||||
exports.finish = function () {
|
||||
clear_invites();
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ var is_customer4 = _.contains(customer4_realms, page_params.domain);
|
|||
|
||||
// Manually-flipped debugging flags
|
||||
exports.log_send_times = false;
|
||||
exports.collect_send_times = false;
|
||||
|
||||
// Permanent realm-specific stuff:
|
||||
|
||||
|
|
Loading…
Reference in New Issue