mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-20 07:43:35 -05:00
Merge pull request #12868 from keithjgrant/12853-ws-event-duplication
Don't add ws events twice to job output
This commit is contained in:
@@ -225,7 +225,6 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
|
||||
}
|
||||
let batchTimeout;
|
||||
let batchedEvents = [];
|
||||
connectJobSocket(job, (data) => {
|
||||
const addBatchedEvents = () => {
|
||||
let min;
|
||||
let max;
|
||||
@@ -244,7 +243,13 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
|
||||
};
|
||||
});
|
||||
setWsEvents((oldWsEvents) => {
|
||||
const updated = oldWsEvents.concat(batchedEvents);
|
||||
const newEvents = [];
|
||||
batchedEvents.forEach((event) => {
|
||||
if (!oldWsEvents.find((e) => e.id === event.id)) {
|
||||
newEvents.push(event);
|
||||
}
|
||||
});
|
||||
const updated = oldWsEvents.concat(newEvents);
|
||||
jobSocketCounter.current = updated.length;
|
||||
return updated.sort((a, b) => a.counter - b.counter);
|
||||
});
|
||||
@@ -258,6 +263,7 @@ function JobOutput({ job, eventRelatedSearchableKeys, eventSearchableKeys }) {
|
||||
batchedEvents = [];
|
||||
};
|
||||
|
||||
connectJobSocket(job, (data) => {
|
||||
if (data.group_name === `${job.type}_events`) {
|
||||
batchedEvents.push(data);
|
||||
clearTimeout(batchTimeout);
|
||||
|
||||
Reference in New Issue
Block a user