From 144468ade27f180d7267b7fef920aa88379fdf00 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Tue, 13 Feb 2018 19:35:46 -0800 Subject: [PATCH] lint fixup --- routes/_actions/streaming.js | 2 +- routes/_actions/timeline.js | 4 ++-- routes/_database/cleanup.js | 18 +++++++++--------- routes/_database/constants.js | 2 +- routes/_database/databaseLifecycle.js | 4 ---- routes/_database/helpers.js | 2 +- routes/_database/timelines.js | 1 - 7 files changed, 14 insertions(+), 19 deletions(-) diff --git a/routes/_actions/streaming.js b/routes/_actions/streaming.js index a508cea..a39ab1f 100644 --- a/routes/_actions/streaming.js +++ b/routes/_actions/streaming.js @@ -78,4 +78,4 @@ export function createStream (streamingApi, instanceName, accessToken, timelineN console.log('reconnected stream for timeline', timelineName) } }) -} \ No newline at end of file +} diff --git a/routes/_actions/timeline.js b/routes/_actions/timeline.js index 9b00f31..4a6a19b 100644 --- a/routes/_actions/timeline.js +++ b/routes/_actions/timeline.js @@ -82,7 +82,7 @@ export async function fetchTimelineItemsOnScrollToBottom () { store.setForTimeline(instanceName, timelineName, { runningUpdate: false }) } -export async function showMoreItemsForCurrentTimeline() { +export async function showMoreItemsForCurrentTimeline () { mark('showMoreItemsForCurrentTimeline') let instanceName = store.get('currentInstance') let timelineName = store.get('currentTimeline') @@ -94,4 +94,4 @@ export async function showMoreItemsForCurrentTimeline() { showHeader: false }) stop('showMoreItemsForCurrentTimeline') -} \ No newline at end of file +} diff --git a/routes/_database/cleanup.js b/routes/_database/cleanup.js index ce84f09..2c966f0 100644 --- a/routes/_database/cleanup.js +++ b/routes/_database/cleanup.js @@ -17,8 +17,8 @@ const BATCH_SIZE = 20 const TIME_AGO = 14 * 24 * 60 * 60 * 1000 // two weeks ago const DELAY = 5 * 60 * 1000 // five minutes -function batchedGetAll(callGetAll, callback) { - function nextBatch() { +function batchedGetAll (callGetAll, callback) { + function nextBatch () { callGetAll().onsuccess = function (e) { let results = e.target.result callback(results) @@ -30,7 +30,7 @@ function batchedGetAll(callGetAll, callback) { nextBatch() } -function cleanupStatuses(statusesStore, statusTimelinesStore, cutoff) { +function cleanupStatuses (statusesStore, statusTimelinesStore, cutoff) { batchedGetAll( () => statusesStore.index(TIMESTAMP).getAll(IDBKeyRange.upperBound(cutoff), BATCH_SIZE), results => { @@ -48,7 +48,7 @@ function cleanupStatuses(statusesStore, statusTimelinesStore, cutoff) { ) } -function cleanupNotifications(notificationsStore, notificationTimelinesStore, cutoff) { +function cleanupNotifications (notificationsStore, notificationTimelinesStore, cutoff) { batchedGetAll( () => notificationsStore.index(TIMESTAMP).getAll(IDBKeyRange.upperBound(cutoff), BATCH_SIZE), results => { @@ -66,7 +66,7 @@ function cleanupNotifications(notificationsStore, notificationTimelinesStore, cu ) } -function cleanupAccounts(accountsStore, cutoff) { +function cleanupAccounts (accountsStore, cutoff) { batchedGetAll( () => accountsStore.index(TIMESTAMP).getAll(IDBKeyRange.upperBound(cutoff), BATCH_SIZE), (results) => { @@ -77,7 +77,7 @@ function cleanupAccounts(accountsStore, cutoff) { ) } -function cleanupRelationships(relationshipsStore, cutoff) { +function cleanupRelationships (relationshipsStore, cutoff) { batchedGetAll( () => relationshipsStore.index(TIMESTAMP).getAll(IDBKeyRange.upperBound(cutoff), BATCH_SIZE), (results) => { @@ -88,7 +88,7 @@ function cleanupRelationships(relationshipsStore, cutoff) { ) } -async function cleanup(instanceName) { +async function cleanup (instanceName) { console.log('cleanup', instanceName) mark(`cleanup:${instanceName}`) let db = await getDatabase(instanceName) @@ -120,7 +120,7 @@ async function cleanup(instanceName) { stop(`cleanup:${instanceName}`) } -function doCleanup(instanceName) { +function doCleanup (instanceName) { scheduleIdleTask(() => cleanup(instanceName)) } @@ -132,4 +132,4 @@ function scheduledCleanup () { } } -export const scheduleCleanup = debounce(() => scheduleIdleTask(scheduledCleanup), DELAY) \ No newline at end of file +export const scheduleCleanup = debounce(() => scheduleIdleTask(scheduledCleanup), DELAY) diff --git a/routes/_database/constants.js b/routes/_database/constants.js index 59c2a30..87803be 100644 --- a/routes/_database/constants.js +++ b/routes/_database/constants.js @@ -10,4 +10,4 @@ export const PINNED_STATUSES_STORE = 'pinned_statuses' export const TIMESTAMP = '__pinafore_ts' export const ACCOUNT_ID = '__pinafore_acct_id' export const STATUS_ID = '__pinafore_status_id' -export const REBLOG_ID = '__pinafore_reblog_id' \ No newline at end of file +export const REBLOG_ID = '__pinafore_reblog_id' diff --git a/routes/_database/databaseLifecycle.js b/routes/_database/databaseLifecycle.js index a51e9f5..4ad593e 100644 --- a/routes/_database/databaseLifecycle.js +++ b/routes/_database/databaseLifecycle.js @@ -15,10 +15,6 @@ const databaseCache = {} const DB_VERSION = 1 -function objectStore(db, name, keyPath) { - return db.createObjectStore(name, {keyPath: keypPath}) -} - export function getDatabase (instanceName) { if (!instanceName) { throw new Error('instanceName is undefined in getDatabase()') diff --git a/routes/_database/helpers.js b/routes/_database/helpers.js index 6d951ac..05c7e48 100644 --- a/routes/_database/helpers.js +++ b/routes/_database/helpers.js @@ -48,4 +48,4 @@ export function cloneForStorage (obj) { } res[TIMESTAMP] = Date.now() return res -} \ No newline at end of file +} diff --git a/routes/_database/timelines.js b/routes/_database/timelines.js index 489bd8d..3ac4147 100644 --- a/routes/_database/timelines.js +++ b/routes/_database/timelines.js @@ -13,7 +13,6 @@ import { REBLOG_ID, STATUS_ID } from './constants' -import { scheduleCleanup } from './cleanup' function createTimelineKeyRange (timeline, maxId) { let negBigInt = maxId && toReversePaddedBigInt(maxId)