forked from penguin86/luna-tracker
Avoid logboog to grow too much
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
package it.danieleverducci.lunatracker.entities
|
||||
|
||||
class Logbook {
|
||||
companion object {
|
||||
val MAX_SAFE_LOGBOOK_SIZE = 30000
|
||||
}
|
||||
val logs = ArrayList<LunaEvent>()
|
||||
|
||||
fun isTooBig(): Boolean {
|
||||
return logs.size > MAX_SAFE_LOGBOOK_SIZE
|
||||
}
|
||||
|
||||
/**
|
||||
* Halves the logbook to avoid the file being too big
|
||||
*/
|
||||
fun trim() {
|
||||
logs.subList(MAX_SAFE_LOGBOOK_SIZE/2, logs.size).clear()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user