Page Menu
Home
GitPull.it
Search
Configure Global Search
Log In
Files
F8442080
D210.1770959676.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.1770959676.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
Fri, Feb 13, 06:14 (14 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1622365
Default Alt Text
D210.1770959676.diff (1 KB)
Attached To
Mode
D210: Fix bugs in the map
Attached
Detach File
Event Timeline
Log In to Comment