Fix build and lint errors

This commit is contained in:
Jonas Lochmann 2021-03-08 01:00:00 +01:00
parent 828399ec14
commit 8665e614b5
No known key found for this signature in database
GPG key ID: 8B8C9AEE10FA5B36
2 changed files with 4 additions and 6 deletions

View file

@ -21,15 +21,13 @@ import { Database } from '../main'
export class SerializationFeatureCheckException extends Error {}
export function shouldRetryWithException(database: Database, e: any): boolean {
export function shouldRetryWithException (database: Database, e: any): boolean {
if (e instanceof Sequelize.TimeoutError) return true
if (!(e instanceof Sequelize.DatabaseError)) return false
const parent = e.parent
if (typeof parent !== 'object') return false
if (database.dialect === 'sqlite') {
if (parent.message.startsWith('SQLITE_BUSY:')) return true
} else if (database.dialect === 'postgres') {
@ -48,7 +46,7 @@ export function shouldRetryWithException(database: Database, e: any): boolean {
return false
}
export async function assertSerializeableTransactionsAreWorking(database: Database) {
export async function assertSerializeableTransactionsAreWorking (database: Database) {
// clean up just for the case
await database.config.destroy({
where: {
@ -83,7 +81,7 @@ export async function assertSerializeableTransactionsAreWorking(database: Databa
})(),
(async () => {
await database.config.update({ value: 'd' }, { where: { id: configItemIds.secondSelfTestData }, transaction: transactionTwo })
})(),
})()
])
})
})

View file

@ -104,7 +104,7 @@ export const applyActionsFromDevice = async ({ database, request, websocket, con
}
})
} catch (ex) {
if (shouldRetryWithException(ex)) {
if (shouldRetryWithException(ex, database)) {
eventHandler.countEvent('applyActionsFromDevice got exception which should cause retry')
throw ex