fix: change database commit to flush in new_user function
- Updated the new_user function in database.py to use db.flush() instead of db.commit() for adding new users. This change ensures that the user object is added to the session without committing the transaction, allowing for better control over database operations.
This commit is contained in:
parent
068000515a
commit
b8f65547b2
@ -54,7 +54,7 @@ def new_user() -> int:
|
||||
user = User()
|
||||
user.last_seen = user.created_at = datetime.now(UTC)
|
||||
db.add(user)
|
||||
db.commit()
|
||||
db.flush()
|
||||
return user.id
|
||||
finally:
|
||||
db.close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user