Skip to content

Commit f799df5

Browse files
Make it so that leaves with unknown volume get a volume when they finish
Co-Authored-By: Sören Reichardt <[email protected]> Co-Authored-By: Adam Schill Collberg<[email protected]>
1 parent 7996606 commit f799df5

File tree

2 files changed

+4
-2
lines changed
  • core/src

2 files changed

+4
-2
lines changed

core/src/main/java/org/neo4j/gds/core/utils/progress/tasks/LeafTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void finish() {
3939

4040
// This task should now be considered to have 100% progress.
4141
if (volume == UNKNOWN_VOLUME) {
42-
volume = 0;
42+
volume = currentProgress.longValue();
4343
}
4444
currentProgress.add(volume - currentProgress.longValue());
4545
}

core/src/test/java/org/neo4j/gds/core/utils/progress/tasks/TaskTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,11 @@ void shouldSetProgressWhenFinishingTask() {
221221
task.start();
222222
var leaf1 = task.nextSubtask();
223223
leaf1.start();
224-
leaf1.setVolume(22L);
224+
leaf1.logProgress(22L);
225225
leaf1.finish();
226226

227227
assertThat(leaf1.getProgress().progress()).isEqualTo(22L);
228+
assertThat(leaf1.getProgress().volume()).isEqualTo(22L);
228229
assertThat(task.getProgress().volume()).isEqualTo(Task.UNKNOWN_VOLUME);
229230

230231
var leaf2 = task.nextSubtask();
@@ -233,6 +234,7 @@ void shouldSetProgressWhenFinishingTask() {
233234
leaf2.finish();
234235

235236
assertThat(leaf2.getProgress().progress()).isEqualTo(20L);
237+
assertThat(leaf2.getProgress().volume()).isEqualTo(20L);
236238
assertThat(task.getProgress().volume()).isEqualTo(Task.UNKNOWN_VOLUME);
237239

238240
task.finish();

0 commit comments

Comments
 (0)