Page Menu
Home
GitPull.it
Search
Configure Global Search
Log In
Files
F13820355
D210.1788228020.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D210.1788228020.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
Tue, Sep 1, 04:00 (19 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2098880
Default Alt Text
D210.1788228020.diff (1 KB)
Attached To
Mode
D210: Fix bugs in the map
Attached
Detach File
Event Timeline