lint fixup
This commit is contained in:
		
							parent
							
								
									92f6dd96c0
								
							
						
					
					
						commit
						144468ade2
					
				
					 7 changed files with 14 additions and 19 deletions
				
			
		| 
						 | 
				
			
			@ -78,4 +78,4 @@ export function createStream (streamingApi, instanceName, accessToken, timelineN
 | 
			
		|||
      console.log('reconnected stream for timeline', timelineName)
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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')
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
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 ACCOUNT_ID = '__pinafore_acct_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
 | 
			
		||||
 | 
			
		||||
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()')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,4 +48,4 @@ export function cloneForStorage (obj) {
 | 
			
		|||
  }
 | 
			
		||||
  res[TIMESTAMP] = Date.now()
 | 
			
		||||
  return res
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,7 +13,6 @@ import {
 | 
			
		|||
  REBLOG_ID,
 | 
			
		||||
  STATUS_ID
 | 
			
		||||
} from './constants'
 | 
			
		||||
import { scheduleCleanup } from './cleanup'
 | 
			
		||||
 | 
			
		||||
function createTimelineKeyRange (timeline, maxId) {
 | 
			
		||||
  let negBigInt = maxId && toReversePaddedBigInt(maxId)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue