From d92200a6d6a81ac0c6a739f0297935bb060a974f Mon Sep 17 00:00:00 2001 From: dogcraft Date: Sun, 10 Jul 2022 10:02:46 +0800 Subject: [PATCH] fix: QueryFailedError when logging user's IPs (#8973) * fix QueryFailedError when logging user's IPs * use `orIgnore` to fix --- packages/backend/src/server/api/api-handler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/api-handler.ts b/packages/backend/src/server/api/api-handler.ts index 34ff970b4c..ec71ddd2c0 100644 --- a/packages/backend/src/server/api/api-handler.ts +++ b/packages/backend/src/server/api/api-handler.ts @@ -68,11 +68,11 @@ export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise((res } try { - UserIps.insert({ + UserIps.createQueryBuilder().insert().values({ createdAt: new Date(), userId: user.id, ip: ip, - }); + }).orIgnore(true).execute(); } catch { } }