@yarkivaev/scada 2.3.83 → 2.3.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ export default function segmentNormalize(parsed) {
|
|
|
17
17
|
const hasOpts = Array.isArray(parsed.options) && parsed.options.length > 0;
|
|
18
18
|
const resolved = typeof parsed.resolved === 'boolean' ? parsed.resolved : !hasOpts;
|
|
19
19
|
return {
|
|
20
|
-
type: parsed.type,
|
|
20
|
+
type: parsed.type || 'segment',
|
|
21
21
|
machine: parsed.machine,
|
|
22
22
|
name: parsed.name,
|
|
23
23
|
kind: typeof parsed.kind === 'string' && parsed.kind.length > 0 ? parsed.kind : 'phase',
|
|
@@ -153,6 +153,8 @@ export default function segmentCoalesce(codec, options = {}) {
|
|
|
153
153
|
const ctx = { api, lane, codec, size, intervalMs };
|
|
154
154
|
lane.queue = lane.queue.then(() => {
|
|
155
155
|
return step(ctx, envelope, parsed);
|
|
156
|
+
}).catch(() => {
|
|
157
|
+
return undefined;
|
|
156
158
|
});
|
|
157
159
|
return lane.queue;
|
|
158
160
|
},
|
|
@@ -13,21 +13,21 @@
|
|
|
13
13
|
export default async function abutSegments(pool, budgetSeconds) {
|
|
14
14
|
await pool.query(
|
|
15
15
|
`UPDATE segments AS left_row
|
|
16
|
-
SET end_time =
|
|
17
|
-
duration = EXTRACT(EPOCH FROM (
|
|
18
|
-
FROM
|
|
19
|
-
SELECT
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
AND left_row.name =
|
|
29
|
-
AND
|
|
30
|
-
AND
|
|
16
|
+
SET end_time = next_row.next_start,
|
|
17
|
+
duration = EXTRACT(EPOCH FROM (next_row.next_start - left_row.start_time))
|
|
18
|
+
FROM (
|
|
19
|
+
SELECT machine, kind, start_time,
|
|
20
|
+
lead(start_time) OVER (PARTITION BY machine, kind ORDER BY start_time) AS next_start,
|
|
21
|
+
lead(name) OVER (PARTITION BY machine, kind ORDER BY start_time) AS next_name
|
|
22
|
+
FROM segments
|
|
23
|
+
) AS next_row
|
|
24
|
+
WHERE left_row.machine = next_row.machine
|
|
25
|
+
AND left_row.kind = next_row.kind
|
|
26
|
+
AND left_row.start_time = next_row.start_time
|
|
27
|
+
AND left_row.duration > 0
|
|
28
|
+
AND left_row.name = next_row.next_name
|
|
29
|
+
AND next_row.next_start > left_row.end_time
|
|
30
|
+
AND next_row.next_start - left_row.end_time <= make_interval(secs => $1)`,
|
|
31
31
|
[budgetSeconds]
|
|
32
32
|
);
|
|
33
33
|
}
|