perf improvement for db cleanup
This commit is contained in:
parent
0dbfbcf0f2
commit
9bb9632913
|
@ -14,6 +14,9 @@ async function cleanup(instanceName, timeline) {
|
||||||
|
|
||||||
store.count().onsuccess = (e) => {
|
store.count().onsuccess = (e) => {
|
||||||
let count = e.target.result
|
let count = e.target.result
|
||||||
|
if (count <= MAX_NUM_STORED_STATUSES) {
|
||||||
|
return
|
||||||
|
}
|
||||||
let openKeyCursor = index.openKeyCursor || index.openCursor
|
let openKeyCursor = index.openKeyCursor || index.openCursor
|
||||||
openKeyCursor.call(index, null, 'prev').onsuccess = (e) => {
|
openKeyCursor.call(index, null, 'prev').onsuccess = (e) => {
|
||||||
let cursor = e.target.result
|
let cursor = e.target.result
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { cleanupOldStatuses } from './cleanup'
|
import { cleanupOldStatuses } from './cleanup'
|
||||||
import { OBJECT_STORE, getDatabase, doTransaction } from './shared'
|
import { OBJECT_STORE, getDatabase } from './shared'
|
||||||
import { toReversePaddedBigInt, transformStatusForStorage } from './utils'
|
import { toReversePaddedBigInt, transformStatusForStorage } from './utils'
|
||||||
|
|
||||||
export async function getTimeline(instanceName, timeline, maxId = null, limit = 20) {
|
export async function getTimeline(instanceName, timeline, maxId = null, limit = 20) {
|
||||||
|
|
Loading…
Reference in a new issue