General backend refactoring before major Python 3.12 etc. update #1084
Labels
backend
bug is related to backend
enhancement
this label means that resolving the issue would improve some part of the system
There are a number of things we should do about the current state of the backend, preferably before we'll commence #969 transition to Python 3.12 and general dependency update.
Fully dropping anything related to solely previous v2 version, including v2 Scala-based web interface artifacts and v2 REST APIs which are superseded by the current GraphQL APIs.
Removing Redis-based cache-through system Adding cache-through system #462, as agreed after discussing with Oleg. As experience shows, it does not actually improve performance while adding complexity we can do without.
Perhaps after we transition to Python 3.12 and update dependencies, something better can be done, e.g. maybe based on or with SQLAlchemy's internal caching mechanisms.
Probably needs a separate issue.
Concurrently with everything else, general code cleanup, refactoring, legibility improvement.
Probably needs a separate issue with detailed descriptions of preferred changes and practices. Right now we can mention following:
a) Sort imports according to PEP 8 into standard library, external libraries and project import groups, and sort alphabetically in each group.
b) Remove unused imports via checking with PyFlakes or other source analyzer.
c) Use more concise and legible idioms for frequent operations such as getting objects from DB by id or creating GraphQL wrapper objects from DB objects.
d) Use more Pythonic approach when dealing with DB, whenever possible just do what is required and catch any errors, relying on DB constraints, instead of first checking prerequisite conditions, like e.g. existence of other objects. Should also be more optimal with less DB requests.
The text was updated successfully, but these errors were encountered: