Skip to content

Commit 16ed12c

Browse files
Merge pull request #305 from CropWatchDevelopment/develop
fixed stale red devices that send data less frequently than 30 minutes
2 parents f5bbf84 + 698d783 commit 16ed12c

4 files changed

Lines changed: 7 additions & 15 deletions

File tree

src/lib/utilities/ActiveTimer.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,7 @@ export function createActiveTimer(lastUpdated: Date | null | undefined, interval
3030
const timeDiffMs = now.getTime() - new Date(date).getTime();
3131
const intervalMs = interval * 60 * 1000;
3232

33-
// Add a maximum threshold for device activity (35 minutes) regardless of interval
34-
const MAX_ACTIVE_TIME_MS = 36 * 60 * 1000; // 35 minutes in milliseconds
35-
36-
// If time difference exceeds our maximum threshold, device is inactive
37-
if (timeDiffMs > MAX_ACTIVE_TIME_MS) {
38-
return false;
39-
}
40-
41-
// Device is active if time difference is less than the configured interval
33+
// Device is active if time difference is less than the configured interval (no hard cap)
4234
return timeDiffMs < intervalMs;
4335
}
4436

src/routes/app/dashboard/location/[location_id]/devices/[devEui]/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@
114114
device.upload_interval || device.cw_device_type?.default_upload_interval || 10
115115
);
116116
const STALE_THRESHOLD_MS = $derived(
117-
// Mark stale if no update in 2 * expected interval (cap between 2min and 30min)
118-
Math.min(30, Math.max(2, EXPECTED_UPLOAD_MINUTES * 2)) * 60 * 1000
117+
// Previously capped at 30 min and multiplied by 2. Now strictly use configured interval (in minutes) with no hard cap.
118+
EXPECTED_UPLOAD_MINUTES * 60 * 1000
119119
);
120120
121121
// Active status timer for THIS device (independent of dashboard list)

static/build-info.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"commit": "2f4daa7",
3-
"branch": "workingDateTime",
2+
"commit": "285c3cd",
3+
"branch": "develop",
44
"author": "Kevin Cantrell",
5-
"date": "2025-08-19T17:11:48.136Z",
5+
"date": "2025-08-24T02:09:26.294Z",
66
"builder": "kevin@kevin-desktop",
77
"ipAddress": "192.168.1.100",
8-
"timestamp": 1755623508137
8+
"timestamp": 1756001366295
99
}
File renamed without changes.

0 commit comments

Comments
 (0)