mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2025-10-03 01:39:31 +02:00
Fix build and lint errors
This commit is contained in:
parent
828399ec14
commit
8665e614b5
2 changed files with 4 additions and 6 deletions
|
@ -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 })
|
||||
})(),
|
||||
})()
|
||||
])
|
||||
})
|
||||
})
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue