Skip to content

Fix background task not executed #86

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

Merged
merged 5 commits into from
May 31, 2023
Merged

Fix background task not executed #86

merged 5 commits into from
May 31, 2023

Conversation

wu-clan
Copy link
Member

@wu-clan wu-clan commented May 31, 2023

The custom exception class now supports background params, which are the same as the native JSONResponse, for usage please visit the Starlette documentation

@wu-clan wu-clan requested a review from downdawn May 31, 2023 01:02
@wu-clan wu-clan linked an issue May 31, 2023 that may be closed by this pull request
@downdawn
Copy link
Collaborator

LGTM

background_tasks.add_task(LoginLogService.create, **login_logs_params)
raise errors.AuthorizationError(msg=e.msg)
err_log_info = dict(
db=db, request=request, user=current_user, login_time=self.login_time, status=0, msg=e.msg
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to combine status and msg? Define status with enumeration to represent different errors

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's do the status like this.

@wu-clan wu-clan merged commit 61147d4 into fastapi-practices:master May 31, 2023
@wu-clan wu-clan deleted the fix-backgrounds branch May 31, 2023 08:16
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.

BackgroundTasks task is invalid
2 participants