mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Garmin: re-use FitImporter to reduce memory pressure
This commit is contained in:
+5
-1
@@ -38,6 +38,7 @@ public class FitAsyncProcessor {
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
FitImporter fitImporter = null;
|
||||
int i = 0;
|
||||
for (final File file : files) {
|
||||
i++;
|
||||
@@ -47,10 +48,13 @@ public class FitAsyncProcessor {
|
||||
FitAsyncProcessor.this.handler.post(() -> callback.onProgress(finalI));
|
||||
|
||||
try {
|
||||
final FitImporter fitImporter = new FitImporter(context, gbDevice);
|
||||
if (fitImporter == null) {
|
||||
fitImporter = new FitImporter(context, gbDevice);
|
||||
}
|
||||
fitImporter.importFile(file, isReprocessing);
|
||||
} catch (final Exception ex) {
|
||||
LOG.error("Exception while importing {}", file, ex);
|
||||
fitImporter = null;
|
||||
continue; // do not remove from pending files
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user