Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob] Log last HB time for the BG task

Neeraj Gupta86c6836dc653
diff --git a/mobile/lib/utils/file_uploader.dart b/mobile/lib/utils/file_uploader.dart
index da409b2386..377bfbef37 100644
--- a/mobile/lib/utils/file_uploader.dart
+++ b/mobile/lib/utils/file_uploader.dart
@@ -113,14 +113,20 @@ class FileUploader {
.releaseAllLocksAcquiredBefore(currentTime - kSafeBufferForLockExpiry);
if (!isBackground) {
await _prefs.reload();
- final isBGTaskDead = (_prefs.getInt(kLastBGTaskHeartBeatTime) ?? 0) <
- (currentTime - kBGTaskDeathTimeout);
+ final lastBGTaskHeartBeatTime =
+ _prefs.getInt(kLastBGTaskHeartBeatTime) ?? 0;
+ final isBGTaskDead =
+ lastBGTaskHeartBeatTime < (currentTime - kBGTaskDeathTimeout);
if (isBGTaskDead) {
await _uploadLocks.releaseLocksAcquiredByOwnerBefore(
ProcessType.background.toString(),
currentTime,
);
_logger.info("BG task was found dead, cleared all locks");
+ } else {
+ _logger.info(
+ "BG task is alive, not clearing locks ${DateTime.fromMicrosecondsSinceEpoch(lastBGTaskHeartBeatTime)}",
+ );
}
// ignore: unawaited_futures
_pollBackgroundUploadStatus();