Commit 2f021dae by Nick N. Sukharev

В модуль 'ext-parser.js' добавлены проверки отсутствия запроса к внешней функции…

… или ответа от неё при построении отчёта по вызовам внешних функций
1 parent 5f95cdf9
Showing with 17 additions and 9 deletions
...@@ -83,22 +83,30 @@ module.exports = exports = { ...@@ -83,22 +83,30 @@ module.exports = exports = {
const graph_calls = []; const graph_calls = [];
let max_duration = 0; let max_duration = 0;
for (const [id, event] of Object.entries(collection)) { for (const [id, event] of Object.entries(collection)) {
var wrong_event = false;
// Если, почему-то, у события из коллекции обращений
// к внешним функциям не было запроса к функции или
// ответа от неё, переходим к обработке следующего
// события вызова внешней функции
if (event.request === undefined) wrong_event = true;
if (event.response === undefined) wrong_event = true;
if (wrong_event) {
console.log("wrong external function call info");
try {
console.log(JSON.stringify(event, undefined, 2));
} catch {
console.log(event);
}
continue;
}
const entry = {}; const entry = {};
if (event.response === undefined) {
entry.startTime = new Date(event.request.time)
entry.endTime = new Date();
entry.duration = entry.endTime.getTime() - entry.startTime.getTime();
entry.method = event.request.method;
entry.parameters = event.request.parameters;
entry.result = undefined;
} else {
entry.startTime = new Date(event.work.start) entry.startTime = new Date(event.work.start)
entry.endTime = new Date(event.work.finish); entry.endTime = new Date(event.work.finish);
entry.duration = event.work.duration; entry.duration = event.work.duration;
entry.method = event.request.method; entry.method = event.request.method;
entry.parameters = event.request.parameters; entry.parameters = event.request.parameters;
entry.result = event.response.result; entry.result = event.response.result;
}
if (max_duration < event.work.duration) if (max_duration < event.work.duration)
max_duration = event.work.duration; max_duration = event.work.duration;
graph_calls.push(entry); graph_calls.push(entry);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!