lint fixup
This commit is contained in:
parent
92f6dd96c0
commit
144468ade2
|
@ -78,4 +78,4 @@ export function createStream (streamingApi, instanceName, accessToken, timelineN
|
||||||
console.log('reconnected stream for timeline', timelineName)
|
console.log('reconnected stream for timeline', timelineName)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ export async function fetchTimelineItemsOnScrollToBottom () {
|
||||||
store.setForTimeline(instanceName, timelineName, { runningUpdate: false })
|
store.setForTimeline(instanceName, timelineName, { runningUpdate: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function showMoreItemsForCurrentTimeline() {
|
export async function showMoreItemsForCurrentTimeline () {
|
||||||
mark('showMoreItemsForCurrentTimeline')
|
mark('showMoreItemsForCurrentTimeline')
|
||||||
let instanceName = store.get('currentInstance')
|
let instanceName = store.get('currentInstance')
|
||||||
let timelineName = store.get('currentTimeline')
|
let timelineName = store.get('currentTimeline')
|
||||||
|
@ -94,4 +94,4 @@ export async function showMoreItemsForCurrentTimeline() {
|
||||||
showHeader: false
|
showHeader: false
|
||||||
})
|
})
|
||||||
stop('showMoreItemsForCurrentTimeline')
|
stop('showMoreItemsForCurrentTimeline')
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ const BATCH_SIZE = 20
|
||||||
const TIME_AGO = 14 * 24 * 60 * 60 * 1000 // two weeks ago
|
const TIME_AGO = 14 * 24 * 60 * 60 * 1000 // two weeks ago
|
||||||
const DELAY = 5 * 60 * 1000 // five minutes
|
const DELAY = 5 * 60 * 1000 // five minutes
|
||||||
|
|
||||||
function batchedGetAll(callGetAll, callback) {
|
function batchedGetAll (callGetAll, callback) {
|
||||||
function nextBatch() {
|
function nextBatch () {
|
||||||
callGetAll().onsuccess = function (e) {
|
callGetAll().onsuccess = function (e) {
|
||||||
let results = e.target.result
|
let results = e.target.result
|
||||||
callback(results)
|
callback(results)
|
||||||
|
@ -30,7 +30,7 @@ function batchedGetAll(callGetAll, callback) {
|
||||||
nextBatch()
|
nextBatch()
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanupStatuses(statusesStore, statusTimelinesStore, cutoff) {
|
function cleanupStatuses (statusesStore, statusTimelinesStore, cutoff) {
|
||||||
batchedGetAll(
|
batchedGetAll(
|
||||||
() => statusesStore.index(TIMESTAMP).getAll(IDBKeyRange.upperBound(cutoff), BATCH_SIZE),
|
() => statusesStore.index(TIMESTAMP).getAll(IDBKeyRange.upperBound(cutoff), BATCH_SIZE),
|
||||||
results => {
|
results => {
|
||||||
|
@ -48,7 +48,7 @@ function cleanupStatuses(statusesStore, statusTimelinesStore, cutoff) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanupNotifications(notificationsStore, notificationTimelinesStore, cutoff) {
|
function cleanupNotifications (notificationsStore, notificationTimelinesStore, cutoff) {
|
||||||
batchedGetAll(
|
batchedGetAll(
|
||||||
() => notificationsStore.index(TIMESTAMP).getAll(IDBKeyRange.upperBound(cutoff), BATCH_SIZE),
|
() => notificationsStore.index(TIMESTAMP).getAll(IDBKeyRange.upperBound(cutoff), BATCH_SIZE),
|
||||||
results => {
|
results => {
|
||||||
|
@ -66,7 +66,7 @@ function cleanupNotifications(notificationsStore, notificationTimelinesStore, cu
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanupAccounts(accountsStore, cutoff) {
|
function cleanupAccounts (accountsStore, cutoff) {
|
||||||
batchedGetAll(
|
batchedGetAll(
|
||||||
() => accountsStore.index(TIMESTAMP).getAll(IDBKeyRange.upperBound(cutoff), BATCH_SIZE),
|
() => accountsStore.index(TIMESTAMP).getAll(IDBKeyRange.upperBound(cutoff), BATCH_SIZE),
|
||||||
(results) => {
|
(results) => {
|
||||||
|
@ -77,7 +77,7 @@ function cleanupAccounts(accountsStore, cutoff) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanupRelationships(relationshipsStore, cutoff) {
|
function cleanupRelationships (relationshipsStore, cutoff) {
|
||||||
batchedGetAll(
|
batchedGetAll(
|
||||||
() => relationshipsStore.index(TIMESTAMP).getAll(IDBKeyRange.upperBound(cutoff), BATCH_SIZE),
|
() => relationshipsStore.index(TIMESTAMP).getAll(IDBKeyRange.upperBound(cutoff), BATCH_SIZE),
|
||||||
(results) => {
|
(results) => {
|
||||||
|
@ -88,7 +88,7 @@ function cleanupRelationships(relationshipsStore, cutoff) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function cleanup(instanceName) {
|
async function cleanup (instanceName) {
|
||||||
console.log('cleanup', instanceName)
|
console.log('cleanup', instanceName)
|
||||||
mark(`cleanup:${instanceName}`)
|
mark(`cleanup:${instanceName}`)
|
||||||
let db = await getDatabase(instanceName)
|
let db = await getDatabase(instanceName)
|
||||||
|
@ -120,7 +120,7 @@ async function cleanup(instanceName) {
|
||||||
stop(`cleanup:${instanceName}`)
|
stop(`cleanup:${instanceName}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
function doCleanup(instanceName) {
|
function doCleanup (instanceName) {
|
||||||
scheduleIdleTask(() => cleanup(instanceName))
|
scheduleIdleTask(() => cleanup(instanceName))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,4 +132,4 @@ function scheduledCleanup () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const scheduleCleanup = debounce(() => scheduleIdleTask(scheduledCleanup), DELAY)
|
export const scheduleCleanup = debounce(() => scheduleIdleTask(scheduledCleanup), DELAY)
|
||||||
|
|
|
@ -10,4 +10,4 @@ export const PINNED_STATUSES_STORE = 'pinned_statuses'
|
||||||
export const TIMESTAMP = '__pinafore_ts'
|
export const TIMESTAMP = '__pinafore_ts'
|
||||||
export const ACCOUNT_ID = '__pinafore_acct_id'
|
export const ACCOUNT_ID = '__pinafore_acct_id'
|
||||||
export const STATUS_ID = '__pinafore_status_id'
|
export const STATUS_ID = '__pinafore_status_id'
|
||||||
export const REBLOG_ID = '__pinafore_reblog_id'
|
export const REBLOG_ID = '__pinafore_reblog_id'
|
||||||
|
|
|
@ -15,10 +15,6 @@ const databaseCache = {}
|
||||||
|
|
||||||
const DB_VERSION = 1
|
const DB_VERSION = 1
|
||||||
|
|
||||||
function objectStore(db, name, keyPath) {
|
|
||||||
return db.createObjectStore(name, {keyPath: keypPath})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getDatabase (instanceName) {
|
export function getDatabase (instanceName) {
|
||||||
if (!instanceName) {
|
if (!instanceName) {
|
||||||
throw new Error('instanceName is undefined in getDatabase()')
|
throw new Error('instanceName is undefined in getDatabase()')
|
||||||
|
|
|
@ -48,4 +48,4 @@ export function cloneForStorage (obj) {
|
||||||
}
|
}
|
||||||
res[TIMESTAMP] = Date.now()
|
res[TIMESTAMP] = Date.now()
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ import {
|
||||||
REBLOG_ID,
|
REBLOG_ID,
|
||||||
STATUS_ID
|
STATUS_ID
|
||||||
} from './constants'
|
} from './constants'
|
||||||
import { scheduleCleanup } from './cleanup'
|
|
||||||
|
|
||||||
function createTimelineKeyRange (timeline, maxId) {
|
function createTimelineKeyRange (timeline, maxId) {
|
||||||
let negBigInt = maxId && toReversePaddedBigInt(maxId)
|
let negBigInt = maxId && toReversePaddedBigInt(maxId)
|
||||||
|
|
Loading…
Reference in New Issue