Avoid reallocation inserting logs into database

This commit is contained in:
Jordan Rose
2025-08-04 10:55:22 -07:00
committed by Cody Henthorne
parent 57454a2661
commit 7074684474
2 changed files with 2 additions and 2 deletions

View File

@@ -126,7 +126,7 @@ class PersistentLogger private constructor(application: Application) : Log.Logge
override fun run() {
while (true) {
requests.blockForRequests(buffer)
db.logs.insert(buffer.flatMap { requestToEntries(it) }, System.currentTimeMillis())
db.logs.insert(buffer.asSequence().flatMap { requestToEntries(it) }, System.currentTimeMillis())
buffer.clear()
requests.notifyFlushed()
}