Reviewed-on: sh-edraft.de/kd_discord_bot#282 Reviewed-by: Ebola-Chan <nick.jungmann@gmail.com> Closes #281
This commit is contained in:
commit
1777a32899
@ -1,3 +1,5 @@
|
|||||||
|
import time
|
||||||
|
|
||||||
from cpl_core.database import DatabaseSettings
|
from cpl_core.database import DatabaseSettings
|
||||||
from cpl_core.database.context import DatabaseContext
|
from cpl_core.database.context import DatabaseContext
|
||||||
|
|
||||||
@ -31,4 +33,9 @@ class DBContext(DatabaseContext):
|
|||||||
return super(DBContext, self).select(statement)
|
return super(DBContext, self).select(statement)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._logger.error(__name__, f"Database error caused by {statement}", 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 []
|
return []
|
||||||
|
@ -39,7 +39,8 @@ class UserMutation(QueryABC):
|
|||||||
|
|
||||||
if "levelId" in input:
|
if "levelId" in input:
|
||||||
level = self._levels.get_level_by_id(input["levelId"])
|
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:
|
else:
|
||||||
user.xp = input["xp"] if "xp" in input else user.xp
|
user.xp = input["xp"] if "xp" in input else user.xp
|
||||||
|
|
||||||
|
@ -51,4 +51,4 @@
|
|||||||
"tslib": "^2.4.1",
|
"tslib": "^2.4.1",
|
||||||
"typescript": "~4.9.5"
|
"typescript": "~4.9.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,4 +25,4 @@
|
|||||||
"Name": "sh-edraft-dark-theme"
|
"Name": "sh-edraft-dark-theme"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user