()
| 115 | } |
| 116 | |
| 117 | async flush() { |
| 118 | if (this.queue.length === 0) return; |
| 119 | const queueCopy = this.queue.slice(); |
| 120 | this.queue = []; |
| 121 | for (const chunk of toChunks(queueCopy, 1000)) { |
| 122 | await this.db.insertInto("logs").values(chunk).execute(); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | async rotate() { |
| 127 | const range = Date.now() - WEEK; |
no test coverage detected