1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 04:46:51 +01:00

Garmin: Fix multiple FitAsyncProcessor running in parallel

This commit is contained in:
José Rebelo 2024-09-09 19:37:32 +01:00
parent 14d76cf59b
commit ea41bbd1a9
2 changed files with 3 additions and 5 deletions

View File

@ -545,7 +545,9 @@ public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommuni
return; return;
} }
// Keep the device marked as busy while we process the files asynchronously // Keep the device marked as busy while we process the files asynchronously, but unset
// isBusyFetching so we do not start multiple processors
isBusyFetching = false;
final FitAsyncProcessor fitAsyncProcessor = new FitAsyncProcessor(getContext(), getDevice()); final FitAsyncProcessor fitAsyncProcessor = new FitAsyncProcessor(getContext(), getDevice());
final long[] lastNotificationUpdateTs = new long[]{System.currentTimeMillis()}; final long[] lastNotificationUpdateTs = new long[]{System.currentTimeMillis()};
@ -569,7 +571,6 @@ public class GarminSupport extends AbstractBTLEDeviceSupport implements ICommuni
GB.signalActivityDataFinish(getDevice()); GB.signalActivityDataFinish(getDevice());
GB.updateTransferNotification(null, "", false, 100, getContext()); GB.updateTransferNotification(null, "", false, 100, getContext());
getDevice().sendDeviceUpdateIntent(getContext()); getDevice().sendDeviceUpdateIntent(getContext());
isBusyFetching = false;
} }
}); });
} }

View File

@ -2,7 +2,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit;
import android.content.Context; import android.content.Context;
import android.os.Handler; import android.os.Handler;
import android.widget.Toast;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -15,8 +14,6 @@ import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.PendingFileProvider; import nodomain.freeyourgadget.gadgetbridge.devices.PendingFileProvider;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession; import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.deviceevents.FileDownloadedDeviceEvent;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class FitAsyncProcessor { public class FitAsyncProcessor {
private static final Logger LOG = LoggerFactory.getLogger(FitAsyncProcessor.class); private static final Logger LOG = LoggerFactory.getLogger(FitAsyncProcessor.class);