Skip to content

Commit

Permalink
CB-3508 remove redundant events
Browse files Browse the repository at this point in the history
  • Loading branch information
yagudin10 committed Dec 9, 2024
1 parent 9cb7433 commit f2e3406
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.websocket.event.session.WSSessionSubTaskInfoEvent;
import org.jkiss.dbeaver.model.websocket.event.session.WSSessionTaskInfoEvent;

import java.util.ArrayList;
Expand Down Expand Up @@ -62,7 +61,14 @@ public void subTask(String name) {
} else {
ProgressState progressState = states.get(states.size() - 1);
progressState.subTask = name;
webSession.addSessionEvent(WSSessionSubTaskInfoEvent.start(progressState.id, name));
webSession.addSessionEvent(
WSSessionTaskInfoEvent.update(
progressState.id,
name,
progressState.progress,
progressState.totalWork
)
);
}
}

Expand All @@ -74,7 +80,12 @@ public void worked(int work) {
} else {
ProgressState progressState = states.get(states.size() - 1);
progressState.progress += work;
webSession.addSessionEvent(WSSessionSubTaskInfoEvent.finish(progressState.id, progressState.subTask));
webSession.addSessionEvent(WSSessionTaskInfoEvent.update(
progressState.id,
progressState.taskName,
progressState.progress,
progressState.totalWork
));
}
}

Expand All @@ -85,7 +96,7 @@ public void done() {
} else {
ProgressState progressState = states.get(states.size() - 1);
states.remove(states.size() - 1);
webSession.addSessionEvent(WSSessionTaskInfoEvent.finish(progressState.id));
webSession.addSessionEvent(WSSessionTaskInfoEvent.finish(progressState.id, progressState.progress));
}
super.done();
// Restore previous state
Expand Down

0 comments on commit f2e3406

Please sign in to comment.