From bb41634991fe81e0bde73c1e5ddf2541bec69cff Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 19 Oct 2021 20:49:43 +0200 Subject: Fix db --- src/index.ts | 2 +- src/services/postDatabase.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 90a8f5b..7fe2128 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ import * as jobs from "./services/jobs"; import * as cliArgs from "ts-command-line-args"; import PostDatabase from "./services/postDatabase"; -export const queueDb = new PostDatabase("queue.json", 50); +export const queueDb = new PostDatabase("queue.json"); const args = cliArgs.parse<{ id?: number; diff --git a/src/services/postDatabase.ts b/src/services/postDatabase.ts index ab5db28..63227a2 100644 --- a/src/services/postDatabase.ts +++ b/src/services/postDatabase.ts @@ -38,7 +38,7 @@ export class PostDatabase { const entries = t.array(PostDatabaseEntryC).decode(fileContent); if (f.either.isRight(entries)) { - this.entries = this.max ? entries.right.slice(0, -1 * this.max) : entries.right; + this.entries = this.max ? entries.right.slice(-1 * this.max) : entries.right; } } -- cgit v1.2.3-70-g09d2