Skip to content

Commit 3476ec4

Browse files
committed
fix: update progress count regardless of error
1 parent e9bca6e commit 3476ec4

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

core/src/main/java/com/fpf/smartscansdk/core/processors/BatchProcessor.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ abstract class BatchProcessor<Input, Output>(
4444
semaphore.withPermit {
4545
try {
4646
val output = onProcess(application, item)
47-
val current = processedCount.incrementAndGet()
48-
val progress = current.toFloat() / items.size
49-
listener?.onProgress(application, progress)
5047
output
5148
} catch (e: Exception) {
5249
listener?.onError(application, e, item)
5350
null
51+
}finally {
52+
val current = processedCount.incrementAndGet()
53+
val progress = current.toFloat() / items.size
54+
listener?.onProgress(application, progress)
5455
}
5556
}
5657
}

0 commit comments

Comments
 (0)