mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2026-08-31 19:03:45 +02:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc80ccc731 | ||
|
|
6bf6cce720 | ||
|
|
5950f7348f | ||
|
|
8d4ffab683 | ||
|
|
44e292309c | ||
|
|
da02bbb2df | ||
|
|
98819fa2d5 | ||
|
|
82230f6c40 | ||
|
|
70a4d36b16 |
+6
-3
@@ -1,12 +1,15 @@
|
||||
FROM node:14-alpine
|
||||
FROM node:16-alpine
|
||||
|
||||
# Create app directories
|
||||
RUN mkdir -p /usr/src/app
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Install app dependencies
|
||||
COPY . /usr/src/app/
|
||||
RUN npm install --no-optional && npm run build && npm prune --production && rm -rf ./src
|
||||
COPY package.json package-lock.json tsconfig.json tslint.json Readme.md /usr/src/app/
|
||||
COPY src/ /usr/src/app/src/
|
||||
COPY scripts/ /usr/src/app/scripts/
|
||||
COPY other/ /usr/src/app/other/
|
||||
RUN mkdir -p docs/schema && npm install --no-optional && npm run build && npm prune --production && rm -rf ./src
|
||||
|
||||
# Start the App
|
||||
EXPOSE 8080
|
||||
|
||||
@@ -160,16 +160,7 @@
|
||||
}
|
||||
],
|
||||
"minItems": 2,
|
||||
"additionalItems": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
}
|
||||
]
|
||||
}
|
||||
"maxItems": 2
|
||||
}
|
||||
},
|
||||
"sdl": {
|
||||
@@ -191,22 +182,7 @@
|
||||
}
|
||||
],
|
||||
"minItems": 4,
|
||||
"additionalItems": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
}
|
||||
]
|
||||
}
|
||||
"maxItems": 4
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -343,16 +319,7 @@
|
||||
}
|
||||
],
|
||||
"minItems": 2,
|
||||
"additionalItems": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
"maxItems": 2
|
||||
}
|
||||
},
|
||||
"updatedOrAdded": {
|
||||
|
||||
+9
-11
@@ -4,22 +4,17 @@ You can run the timelimit server with docker. Here are two example configuration
|
||||
|
||||
## Important
|
||||
|
||||
The ``image: 'timelimit-server:latest'`` will not work out of the box.
|
||||
You have to build this image yourself (using ``sudo docker build -t timelimit-server --no-cache --pull .``
|
||||
within the root directory of this git repository) or you can replace it by
|
||||
``image: docker.timelimit.io/timelimit-server`` which will use prebuilt docker
|
||||
images.
|
||||
|
||||
In case of self building the image, don't forget to run ``docker-compose up`` again
|
||||
to make docker use the new image.
|
||||
Watch out to actually rebuild the images and restart the containers after updates (for example using ``docker-compose up --build``).
|
||||
|
||||
## example docker-compose.yml with included database
|
||||
|
||||
```
|
||||
# change the passwords and use https://docs.docker.com/compose/environment-variables/
|
||||
# to keep sensitives value in a .env file while using ${VAR_NAME} here instead
|
||||
version: '3'
|
||||
services:
|
||||
api:
|
||||
image: 'timelimit-server:latest'
|
||||
build: /path/to/the/timelimit/source/code
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
DATABASE_URL: mariadb://timelimit:timelimitpassword@database:3306/timelimit
|
||||
@@ -62,10 +57,12 @@ before it starts working.
|
||||
## example docker-compose.yml with external databases
|
||||
|
||||
```
|
||||
version: '2'
|
||||
# change the passwords and use https://docs.docker.com/compose/environment-variables/
|
||||
# to keep sensitives value in a .env file while using ${VAR_NAME} here instead
|
||||
version: '3'
|
||||
services:
|
||||
api:
|
||||
image: 'timelimit-server:latest'
|
||||
build: /path/to/the/timelimit/source/code
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
DATABASE_URL: postgres://user:pass@example.com:5432/dbname
|
||||
@@ -87,4 +84,5 @@ services:
|
||||
# - "9000:8080"
|
||||
# in case the database runs outside of docker and you don't want to use the host network mode, see
|
||||
# https://forums.docker.com/t/accessing-host-machine-from-within-docker-container/14248
|
||||
# or don't use docker ...
|
||||
```
|
||||
|
||||
@@ -4,7 +4,7 @@ There are 3 options for running this application:
|
||||
|
||||
Option 1: Build a docker image and use it
|
||||
Option 2: Install Node.JS (see [npm-commands](./npm-commands.md))
|
||||
Option 3: Use a prebuilt docker image
|
||||
Option 3: Use ``timelimit-server-setup.sh`` if there is nothing yet at your system
|
||||
|
||||
After starting it, you can open ``http://server/time`` to test it,
|
||||
it should show a timestamp
|
||||
|
||||
Generated
+5706
-84
File diff suppressed because it is too large
Load Diff
+3
-2
@@ -44,7 +44,7 @@
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-standard": "^9.0.0",
|
||||
"typescript": "^4.1.3",
|
||||
"typescript-json-schema": "^0.46.0"
|
||||
"typescript-json-schema": "^0.52.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ajv": "^7.0.2",
|
||||
@@ -61,8 +61,9 @@
|
||||
"pg": "^8.5.1",
|
||||
"pg-hstore": "^2.3.3",
|
||||
"rate-limiter-flexible": "^2.1.15",
|
||||
"sequelize": "^6.3.5",
|
||||
"sequelize": "^6.11.0",
|
||||
"socket.io": "^4.0.1",
|
||||
"sqlite3": "^4.0.6",
|
||||
"tokgen": "^1.0.0",
|
||||
"umzug": "^2.3.0"
|
||||
},
|
||||
|
||||
@@ -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
|
||||
@@ -16,25 +16,43 @@
|
||||
*/
|
||||
|
||||
import { ParentAction } from './basetypes'
|
||||
import { assertIdWithinFamily } from './meta/util'
|
||||
import { assertIdWithinFamily, assertSafeInteger, throwOutOfRange } from './meta/util'
|
||||
|
||||
const actionType = 'UpdateCategoryBlockAllNotificationsAction'
|
||||
|
||||
export class UpdateCategoryBlockAllNotificationsAction extends ParentAction {
|
||||
readonly categoryId: string
|
||||
readonly blocked: boolean
|
||||
readonly blockDelay: number | undefined
|
||||
|
||||
constructor ({ categoryId, blocked }: {categoryId: string, blocked: boolean}) {
|
||||
constructor ({ categoryId, blocked, blockDelay }: {
|
||||
categoryId: string
|
||||
blocked: boolean
|
||||
blockDelay: number | undefined
|
||||
}) {
|
||||
super()
|
||||
|
||||
assertIdWithinFamily({ actionType, field: 'categoryId', value: categoryId })
|
||||
|
||||
if (blockDelay !== undefined) {
|
||||
assertSafeInteger({ actionType, field: 'blockDelay', value: blockDelay })
|
||||
|
||||
if (blockDelay < 0) {
|
||||
throwOutOfRange({ actionType, field: 'blockDelay', value: blockDelay })
|
||||
}
|
||||
}
|
||||
|
||||
this.categoryId = categoryId
|
||||
this.blocked = blocked
|
||||
this.blockDelay = blockDelay
|
||||
}
|
||||
|
||||
static parse = ({ categoryId, blocked }: SerializedUpdateCategoryBlockAllNotificationsAction) => (
|
||||
new UpdateCategoryBlockAllNotificationsAction({ categoryId, blocked })
|
||||
static parse = ({ categoryId, blocked, blockDelay }: SerializedUpdateCategoryBlockAllNotificationsAction) => (
|
||||
new UpdateCategoryBlockAllNotificationsAction({
|
||||
categoryId,
|
||||
blocked,
|
||||
blockDelay: blockDelay
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
@@ -42,4 +60,5 @@ export interface SerializedUpdateCategoryBlockAllNotificationsAction {
|
||||
type: 'UPDATE_CATEGORY_BLOCK_ALL_NOTIFICATIONS'
|
||||
categoryId: string
|
||||
blocked: boolean
|
||||
blockDelay: number | undefined
|
||||
}
|
||||
|
||||
+10
-36
@@ -940,6 +940,9 @@ const definitions = {
|
||||
},
|
||||
"blocked": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"blockDelay": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
@@ -1498,16 +1501,7 @@ const definitions = {
|
||||
}
|
||||
],
|
||||
"minItems": 2,
|
||||
"additionalItems": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
}
|
||||
]
|
||||
}
|
||||
"maxItems": 2
|
||||
}
|
||||
},
|
||||
"sdl": {
|
||||
@@ -1529,22 +1523,7 @@ const definitions = {
|
||||
}
|
||||
],
|
||||
"minItems": 4,
|
||||
"additionalItems": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
}
|
||||
]
|
||||
}
|
||||
"maxItems": 4
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1675,16 +1654,7 @@ const definitions = {
|
||||
}
|
||||
],
|
||||
"minItems": 2,
|
||||
"additionalItems": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
"maxItems": 2
|
||||
}
|
||||
},
|
||||
"updatedOrAdded": {
|
||||
@@ -2081,11 +2051,15 @@ const definitions = {
|
||||
},
|
||||
"flags": {
|
||||
"type": "number"
|
||||
},
|
||||
"blockNotificationDelay": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"blockAllNotifications",
|
||||
"blockNotificationDelay",
|
||||
"blockedTimes",
|
||||
"categoryId",
|
||||
"childId",
|
||||
|
||||
@@ -83,10 +83,15 @@ export interface CategoryAttributesVersion11 {
|
||||
flags: string
|
||||
}
|
||||
|
||||
export interface CategoryAttributesVersion12 {
|
||||
blockNotificationDelay: string
|
||||
}
|
||||
|
||||
export type CategoryAttributes = CategoryAttributesVersion1 & CategoryAttributesVersion2 &
|
||||
CategoryAttributesVersion3 & CategoryAttributesVersion4 & CategoryAttributesVersion5 &
|
||||
CategoryAttributesVersion6 & CategoryAttributesVersion7 & CategoryAttributesVersion8 &
|
||||
CategoryAttributesVersion9 & CategoryAttributesVersion10 & CategoryAttributesVersion11
|
||||
CategoryAttributesVersion9 & CategoryAttributesVersion10 & CategoryAttributesVersion11 &
|
||||
CategoryAttributesVersion12
|
||||
|
||||
export type CategoryModel = Sequelize.Model<CategoryAttributes> & CategoryAttributes
|
||||
export type CategoryModelStatic = typeof Sequelize.Model & {
|
||||
@@ -232,6 +237,17 @@ export const attributesVersion11: SequelizeAttributes<CategoryAttributesVersion1
|
||||
}
|
||||
}
|
||||
|
||||
export const attributesVersion12: SequelizeAttributes<CategoryAttributesVersion12> = {
|
||||
blockNotificationDelay: {
|
||||
type: Sequelize.BIGINT,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
validate: {
|
||||
min: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const attributes: SequelizeAttributes<CategoryAttributes> = {
|
||||
...attributesVersion1,
|
||||
...attributesVersion2,
|
||||
@@ -243,7 +259,8 @@ export const attributes: SequelizeAttributes<CategoryAttributes> = {
|
||||
...attributesVersion8,
|
||||
...attributesVersion9,
|
||||
...attributesVersion10,
|
||||
...attributesVersion11
|
||||
...attributesVersion11,
|
||||
...attributesVersion12
|
||||
}
|
||||
|
||||
export const createCategoryModel = (sequelize: Sequelize.Sequelize): CategoryModelStatic => sequelize.define('Category', attributes) as CategoryModelStatic
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* server component for the TimeLimit App
|
||||
* 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
|
||||
* published by the Free Software Foundation, version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { QueryInterface, Sequelize, Transaction } from 'sequelize'
|
||||
import { attributesVersion12 as categoryAttributes } from '../../category'
|
||||
|
||||
export async function up (queryInterface: QueryInterface, sequelize: Sequelize) {
|
||||
await sequelize.transaction({
|
||||
type: Transaction.TYPES.EXCLUSIVE
|
||||
}, async (transaction) => {
|
||||
await queryInterface.addColumn('Categories', 'blockNotificationDelay', {
|
||||
...categoryAttributes.blockNotificationDelay
|
||||
}, {
|
||||
transaction
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export async function down (queryInterface: QueryInterface, sequelize: Sequelize) {
|
||||
await sequelize.transaction({
|
||||
type: Transaction.TYPES.EXCLUSIVE
|
||||
}, async (transaction) => {
|
||||
await queryInterface.removeColumn('Categories', 'blockNotificationDelay', { transaction })
|
||||
})
|
||||
}
|
||||
@@ -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
|
||||
@@ -80,7 +80,8 @@ export async function dispatchCreateCategory ({ action, cache, fromChildSelfLimi
|
||||
taskListVersion: generateVersionId(),
|
||||
minBatteryCharging: 0,
|
||||
minBatteryMobile: 0,
|
||||
flags: '0'
|
||||
flags: '0',
|
||||
blockNotificationDelay: '0'
|
||||
}, { transaction: cache.transaction })
|
||||
|
||||
// update the cache
|
||||
|
||||
+15
-3
@@ -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
|
||||
@@ -31,13 +31,18 @@ export async function dispatchUpdateCategoryBlockAllNotifications ({ action, cac
|
||||
categoryId: action.categoryId
|
||||
},
|
||||
transaction: cache.transaction,
|
||||
attributes: ['childId']
|
||||
attributes: ['childId', 'blockAllNotifications']
|
||||
})
|
||||
|
||||
if (!categoryEntryUnsafe) {
|
||||
throw new MissingCategoryException()
|
||||
}
|
||||
|
||||
const categoryEntry = {
|
||||
childId: categoryEntryUnsafe.childId,
|
||||
blockAllNotifications: categoryEntryUnsafe.blockAllNotifications
|
||||
}
|
||||
|
||||
if (fromChildSelfLimitAddChildUserId !== null) {
|
||||
if (fromChildSelfLimitAddChildUserId !== categoryEntryUnsafe.childId) {
|
||||
throw new CanNotModifyOtherUsersBySelfLimitationException()
|
||||
@@ -46,10 +51,17 @@ export async function dispatchUpdateCategoryBlockAllNotifications ({ action, cac
|
||||
if (!action.blocked) {
|
||||
throw new SelfLimitationException({ staticMessage: 'can not disable notification filter as child' })
|
||||
}
|
||||
|
||||
if (categoryEntry.blockAllNotifications && action.blockDelay !== undefined) {
|
||||
throw new SelfLimitationException({ staticMessage: 'can not update the block delay as child' })
|
||||
}
|
||||
}
|
||||
|
||||
const [affectedRows] = await cache.database.category.update({
|
||||
const [affectedRows] = await cache.database.category.update(action.blockDelay === undefined ? {
|
||||
blockAllNotifications: action.blocked
|
||||
} : {
|
||||
blockAllNotifications: action.blocked,
|
||||
blockNotificationDelay: action.blockDelay.toString(10)
|
||||
}, {
|
||||
where: {
|
||||
familyId: cache.familyId,
|
||||
|
||||
@@ -104,7 +104,7 @@ export const applyActionsFromDevice = async ({ database, request, websocket, con
|
||||
}
|
||||
})
|
||||
} catch (ex) {
|
||||
if (shouldRetryWithException(ex, database)) {
|
||||
if (shouldRetryWithException(database, ex)) {
|
||||
eventHandler.countEvent('applyActionsFromDevice got exception which should cause retry')
|
||||
|
||||
throw ex
|
||||
|
||||
@@ -52,7 +52,8 @@ export async function getCategoryBaseDatas ({
|
||||
'temporarilyBlockedEndTime',
|
||||
'sort',
|
||||
'disableLimitsUntil',
|
||||
'flags'
|
||||
'flags',
|
||||
'blockNotificationDelay'
|
||||
],
|
||||
transaction
|
||||
})).map((item) => ({
|
||||
@@ -72,7 +73,8 @@ export async function getCategoryBaseDatas ({
|
||||
temporarilyBlockedEndTime: item.temporarilyBlockedEndTime,
|
||||
sort: item.sort,
|
||||
disableLimitsUntil: item.disableLimitsUntil,
|
||||
flags: item.flags
|
||||
flags: item.flags,
|
||||
blockNotificationDelay: item.blockNotificationDelay
|
||||
}))
|
||||
|
||||
const networkIdsForSyncing = (await database.categoryNetworkId.findAll({
|
||||
@@ -117,6 +119,7 @@ export async function getCategoryBaseDatas ({
|
||||
hashedNetworkId: network.hashedNetworkId
|
||||
})),
|
||||
dlu: parseInt(item.disableLimitsUntil, 10),
|
||||
flags: parseInt(item.flags, 10)
|
||||
flags: parseInt(item.flags, 10),
|
||||
blockNotificationDelay: parseInt(item.blockNotificationDelay, 10)
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ export interface ServerUpdatedCategoryBaseData {
|
||||
// disable limits until
|
||||
dlu: number
|
||||
flags: number
|
||||
blockNotificationDelay: number
|
||||
}
|
||||
|
||||
export interface ServerCategoryNetworkId {
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
}
|
||||
@@ -61,9 +65,7 @@ async function deleteDeprecatedPurchases ({ database, websocket }: {
|
||||
}, {
|
||||
where: {
|
||||
familyId: {
|
||||
[Sequelize.Op.in]: {
|
||||
affectedFamilyIds
|
||||
}
|
||||
[Sequelize.Op.in]: affectedFamilyIds
|
||||
}
|
||||
},
|
||||
transaction
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user