mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix: limit number of parameters per delete operation
Splits the list of message UUIDs into smaller chunks to perform batch deletions with a maximum of 500 UUIDs per operation, avoiding `SQLiteException: too many SQL variables (code 1 SQLITE_ERROR)`. fixes #711
This commit is contained in:
parent
afce253514
commit
ae949ad784
1 changed files with 3 additions and 1 deletions
|
|
@ -47,7 +47,9 @@ class PacketRepository @Inject constructor(private val packetDaoLazy: dagger.Laz
|
|||
}
|
||||
|
||||
suspend fun deleteMessages(uuidList: List<Long>) = withContext(Dispatchers.IO) {
|
||||
packetDao.deleteMessages(uuidList)
|
||||
for (chunk in uuidList.chunked(500)) { // limit number of UUIDs per query
|
||||
packetDao.deleteMessages(chunk)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun deleteWaypoint(id: Int) = withContext(Dispatchers.IO) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue