lint fixup

This commit is contained in:
Nolan Lawson 2018-02-13 19:35:46 -08:00
parent 92f6dd96c0
commit 144468ade2
7 changed files with 14 additions and 19 deletions

View file

@ -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')

View file

@ -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))
} }

View file

@ -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()')

View file

@ -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)