Page Menu
Home
GitPull.it
Search
Configure Global Search
Log In
Files
F11052731
D210.1771876399.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D210.1771876399.diff
View Options
diff --git a/app/src/main/java/it/reyboz/bustorino/backend/mato/MQTTMatoClient.kt b/app/src/main/java/it/reyboz/bustorino/backend/mato/MQTTMatoClient.kt
--- a/app/src/main/java/it/reyboz/bustorino/backend/mato/MQTTMatoClient.kt
+++ b/app/src/main/java/it/reyboz/bustorino/backend/mato/MQTTMatoClient.kt
@@ -375,13 +375,20 @@
val currentTimeStamp = makeUnixTimestamp()
var c = 0
positionsLock.withLock{
- for ((k, manyp) in currentPositions.entries) {
- for ((t, p) in manyp.entries) {
+ for ((k, posByVeh) in currentPositions) {
+ /*for (t in posByVeh.keys.toList()) { // iterate over snapshot to avoid modification error
+ val p = posByVeh[t] ?: continue
if (currentTimeStamp - p.timestamp > timeMins * 60) {
- manyp.remove(t)
+ posByVeh.remove(t)
c += 1
}
}
+ */
+ c+=posByVeh.entries.removeIf{ el ->
+ currentTimeStamp - el.value.timestamp > timeMins * 60
+ }.let {
+ if(it) 1 else 0
+ }
}
}
Log.d(DEBUG_TAG, "Removed $c positions older than $timeMins minutes")
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 23, 20:53 (16 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1662491
Default Alt Text
D210.1771876399.diff (1 KB)
Attached To
Mode
D210: Fix bugs in the map
Attached
Detach File
Event Timeline
Log In to Comment