Add logging background worker execution

This commit is contained in:
Jonas Lochmann 2021-11-15 01:00:00 +01:00
parent 82230f6c40
commit 98819fa2d5
No known key found for this signature in database
GPG key ID: 8B8C9AEE10FA5B36
4 changed files with 23 additions and 7 deletions

View file

@ -25,7 +25,11 @@ export function initDeleteDeprecatedPurchasesWorker ({ database, websocket }: {
websocket: WebsocketApi
}) {
function doWorkSafe () {
deleteDeprecatedPurchases({ database, websocket }).catch((ex) => {
console.log('deleting deprecated purchases now')
deleteDeprecatedPurchases({ database, websocket }).then(() => {
console.log('finished deleting deprecated purchases')
}).catch((ex) => {
console.warn('error deleting deprecated purchases', ex)
})
}

View file

@ -1,6 +1,6 @@
/*
* server component for the TimeLimit App
* Copyright (C) 2019 Jonas Lochmann
* Copyright (C) 2019 - 2021 Jonas Lochmann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@ -22,7 +22,11 @@ export function initDeleteOldFamiliesWorker ({ database }: {
database: Database
}) {
function doWorkSafe () {
deleteOldFamilies(database).catch((ex) => {
console.log('deleting old families now')
deleteOldFamilies(database).then(() => {
console.log('finished deleting old families')
}).catch((ex) => {
console.warn('error deleting old families', ex)
})
}

View file

@ -1,6 +1,6 @@
/*
* server component for the TimeLimit App
* Copyright (C) 2019 Jonas Lochmann
* Copyright (C) 2019 - 2021 Jonas Lochmann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@ -22,7 +22,11 @@ export function initDeleteOldTokensWorker ({ database }: {
database: Database
}) {
function doWorkSafe () {
deleteOldTokens({ database }).catch((ex) => {
console.log('deleting old tokens now')
deleteOldTokens({ database }).then(() => {
console.log('finished deleting old tokens')
}).catch((ex) => {
console.warn('error deleting old tokens', ex)
})
}

View file

@ -1,6 +1,6 @@
/*
* server component for the TimeLimit App
* Copyright (C) 2019 - 2020 Jonas Lochmann
* Copyright (C) 2019 - 2021 Jonas Lochmann
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@ -24,7 +24,11 @@ export function initDeleteOldUsedTimesWorker ({ database }: {
database: Database
}) {
function doWorkSafe () {
deleteOldUsedTimes({ database }).catch((ex) => {
console.log('deleting old used times now')
deleteOldUsedTimes({ database }).then(() => {
console.log('finished deleting old used times')
}).catch((ex) => {
console.warn('error deleting old used times', ex)
})
}