From ccf41bec7912abf0a33a72a342fcb0d5194f21a4 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 29 Mar 2023 15:00:31 +0200 Subject: [PATCH 1/3] Retry select after half a second --- kdb-bot/src/bot_data/db_context.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kdb-bot/src/bot_data/db_context.py b/kdb-bot/src/bot_data/db_context.py index 6e11f284..46eff3bb 100644 --- a/kdb-bot/src/bot_data/db_context.py +++ b/kdb-bot/src/bot_data/db_context.py @@ -1,3 +1,5 @@ +import time + from cpl_core.database import DatabaseSettings from cpl_core.database.context import DatabaseContext @@ -31,4 +33,9 @@ class DBContext(DatabaseContext): return super(DBContext, self).select(statement) except Exception as e: self._logger.error(__name__, f"Database error caused by {statement}", e) + try: + time.sleep(0.5) + return self.select(statement) + except Exception as e: + pass return [] -- 2.45.2 From 8025c31339e0097ae20cd17cbb3c7b26ff1f634d Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 29 Mar 2023 19:38:25 +0200 Subject: [PATCH 2/3] Set xp by level only when incoming level is different from user level #281 --- kdb-bot/src/bot_graphql/mutations/user_mutation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kdb-bot/src/bot_graphql/mutations/user_mutation.py b/kdb-bot/src/bot_graphql/mutations/user_mutation.py index c601aab9..44ef7070 100644 --- a/kdb-bot/src/bot_graphql/mutations/user_mutation.py +++ b/kdb-bot/src/bot_graphql/mutations/user_mutation.py @@ -39,7 +39,8 @@ class UserMutation(QueryABC): if "levelId" in input: level = self._levels.get_level_by_id(input["levelId"]) - user.xp = level.min_xp + if user.level.id != level.id: + user.xp = level.min_xp else: user.xp = input["xp"] if "xp" in input else user.xp -- 2.45.2 From 653562b9087c2a6a64890e86b5a4cf802856d425 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 29 Mar 2023 19:38:42 +0200 Subject: [PATCH 3/3] idk #281 --- kdb-web/package.json | 2 +- kdb-web/src/assets/config.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kdb-web/package.json b/kdb-web/package.json index b9cc2ae2..613848cf 100644 --- a/kdb-web/package.json +++ b/kdb-web/package.json @@ -51,4 +51,4 @@ "tslib": "^2.4.1", "typescript": "~4.9.5" } -} +} \ No newline at end of file diff --git a/kdb-web/src/assets/config.json b/kdb-web/src/assets/config.json index 328b0859..deba87e5 100644 --- a/kdb-web/src/assets/config.json +++ b/kdb-web/src/assets/config.json @@ -25,4 +25,4 @@ "Name": "sh-edraft-dark-theme" } ] -} +} \ No newline at end of file -- 2.45.2