diff --git a/src/StorageDatabase.scala b/src/StorageDatabase.scala index 5356fb3..54e5d9d 100644 --- a/src/StorageDatabase.scala +++ b/src/StorageDatabase.scala @@ -203,11 +203,13 @@ class StorageDatabase(context : Context) extends Array(long2Long(ts))) getWritableDatabase().execSQL("DELETE FROM %s WHERE %s < ?".format(Position.TABLE, Position.TS), Array(long2Long(ts))) - getWritableDatabase().execSQL("DELETE FROM %s WHERE %s < ?".format(Station.TABLE, Station.TS), - Array(long2Long(ts))) + // only trim stations on explicit request + if (ts == Long.MaxValue) + getWritableDatabase().execSQL("DELETE FROM %s WHERE %s < ?".format(Station.TABLE, Station.TS), + Array(long2Long(ts))) } - // default trim filter: 31 days in [ms] + // default trim filter: 2 days in [ms] def trimPosts() : Unit = trimPosts(System.currentTimeMillis - 2L * 24 * 3600 * 1000) def addPosition(ts : Long, ap : APRSPacket, pos : Position, objectname : String) { diff --git a/src/UIHelper.scala b/src/UIHelper.scala index 0ada2bf..0a44a02 100644 --- a/src/UIHelper.scala +++ b/src/UIHelper.scala @@ -310,7 +310,7 @@ trait UIHelper extends Activity class StorageCleaner(storage : StorageDatabase) extends MyAsyncTask[Unit, Unit] { override def doInBackground1(params : Array[String]) { Log.d("StorageCleaner", "trimming...") - storage.trimPosts(System.currentTimeMillis) + storage.trimPosts(Long.MaxValue) } override def onPostExecute(x : Unit) { Log.d("StorageCleaner", "broadcasting...")