Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove Server Tasks #3592

Conversation

michael-genson
Copy link
Collaborator

What type of PR is this?

(REQUIRED)

  • cleanup

What this PR does / why we need it:

(REQUIRED)

Removes all mentions of the old server tasks API, except for the database model. I left the database model because otherwise Alembic migrations are going to whine about it, though I added a comment.

Which issue(s) this PR fixes:

(REQUIRED)

Mentioned in #3442

Copy link
Collaborator

@boc-the-git boc-the-git left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have one comment seeking clarification, but ultimately this LGTM

@@ -67,7 +73,7 @@ class Group(SqlAlchemyBase, BaseMixins):
webhooks: Mapped[list[GroupWebhooksModel]] = orm.relationship(GroupWebhooksModel, **common_args)
recipe_actions: Mapped[list["GroupRecipeAction"]] = orm.relationship("GroupRecipeAction", **common_args)
cookbooks: Mapped[list[CookBook]] = orm.relationship(CookBook, **common_args)
server_tasks: Mapped[list[ServerTaskModel]] = orm.relationship(ServerTaskModel, **common_args)
server_tasks: Mapped[list["ServerTaskModel"]] = orm.relationship("ServerTaskModel", **common_args)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this need to change?
(I don't have a problem with it, just not sure why the change is being made)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, that's because I removed the line by accident then put it back (and accidentally did it slightly differently). Specifically it's different because of how imports work with SQLAlchemy: I could've put it back how it was, but I also moved the import to typing only (which means it's not actually imported at runtime):

# earlier in the file
if TYPE_CHECKING:
    ...
    from ..server.task import ServerTaskModel

This is a better way of handling imports in this scenario since it's slightly more performant and avoids circular imports (though that's not actually an issue here). In theory we should replace all of our SQLAlchemy imports to do this, but the performance benefit is negligible so it's not worth the effort.


TL;DR it's a totally unnecessary change I did by accident, but I'm inclined to leave it because it's technically better anyway

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or not at all and prod breaks. Cool
#3630

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least we had fun 😅

@michael-genson michael-genson enabled auto-merge (squash) May 20, 2024 14:44
@michael-genson michael-genson merged commit 61becdb into mealie-recipes:mealie-next May 20, 2024
8 of 9 checks passed
@michael-genson michael-genson deleted the chore/remove-server-tasks branch May 20, 2024 22:20
boc-the-git pushed a commit to boc-the-git/mealie that referenced this pull request May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants