Skip to content

Commit

Permalink
Merge pull request #94 from HopperElec/multiCallSameTime
Browse files Browse the repository at this point in the history
Allow multiple calls at the same time
  • Loading branch information
mlomb authored Nov 22, 2023
2 parents 33696f2 + 3d7a8af commit 90ad151
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pipeline/aggregate/blocks/calls/CallsStats.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Datetime, diffDatetime } from "@pipeline/Time";
import { BlockDescription, BlockFn } from "@pipeline/aggregate/Blocks";
import { VariableDistribution, computeVariableDistribution } from "@pipeline/aggregate/Common";
import { filterMessages } from "@pipeline/aggregate/Helpers";
import { MessageView } from "@pipeline/serialization/MessageView";

interface CallDuration {
duration: number;
Expand Down Expand Up @@ -65,8 +63,11 @@ const fn: BlockFn<CallsStats> = (database, filters, common, args) => {

if (lastCall !== undefined) {
// compute time difference between calls
const diff = diffDatetime(lastCall, startDatetime);
if (diff < 0) throw new Error("Time difference between calls is negative, diff=" + diff);
let diff = diffDatetime(lastCall, startDatetime);
if (diff < 0) {
secondsInCall -= diff; // remove overlap
diff = 0;
}
timesBetween[total - 1] = diff;
}
lastCall = endDatetime;
Expand Down

0 comments on commit 90ad151

Please sign in to comment.