mirror of
https://github.com/simple-login/app.git
synced 2025-09-05 22:24:43 +08:00
Rollback session
This commit is contained in:
parent
794bb28990
commit
2aac58f792
1 changed files with 6 additions and 1 deletions
|
@ -8,6 +8,7 @@ from typing import List, Optional
|
||||||
|
|
||||||
import arrow
|
import arrow
|
||||||
import newrelic.agent
|
import newrelic.agent
|
||||||
|
from sqlalchemy.exc import IntegrityError
|
||||||
from sqlalchemy.orm import Query
|
from sqlalchemy.orm import Query
|
||||||
from sqlalchemy.orm.exc import ObjectDeletedError
|
from sqlalchemy.orm.exc import ObjectDeletedError
|
||||||
from sqlalchemy.sql.expression import or_, and_
|
from sqlalchemy.sql.expression import or_, and_
|
||||||
|
@ -403,4 +404,8 @@ def execute():
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
send_version_event("job_runner")
|
send_version_event("job_runner")
|
||||||
while True:
|
while True:
|
||||||
execute()
|
try:
|
||||||
|
execute()
|
||||||
|
except IntegrityError:
|
||||||
|
Session.rollback()
|
||||||
|
Session.close()
|
||||||
|
|
Loading…
Add table
Reference in a new issue