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

Tortoise-ORM executed an update statement, but the data in the database didn't change #1688

Open
TracyRAN1 opened this issue Aug 1, 2024 · 1 comment

Comments

@TracyRAN1
Copy link

Under high concurrency, Tortoise-ORM executed an update statement, but the data in the database didn't change, and there were no error messages either. What could be the reason for this?

this is my code:
async def update_database_record(model, xs_id: str, updates: dict): async with in_transaction('default'): instance = await model.get(id=xs_id) instance.update_from_dict(updates) await instance.save() logger.info(f"更新数据库记录, model:{model}, xs_id:{xs_id}, updates:{updates}")

this is log:
2024-08-01 19:30:19,056 - DEBUG - tortoise.db_client:197 - 19233 - 139634569598784 - UPDATEDD_APP_ROBOT_PATCH_MESSAGE_RECORDSETORI_CHN=%s,ORI_SYS=%s,ORI_SEQ=%s,POST_TIME=%s,RECEIVE_TIME=%s,RETURN_MSG=%s,SEND_STATUS=%s,CODE=%s,ROBOT_CODE=%s,IDTYPE=%s,USERIDS=%s,TRANS_USERIDS=%s,MSGKEY=%s,MSGPARAM=%s,REQ_DATA=%s,PROCESSQUERYKEY=%s,INVALIDSTAFFIDLIST=%s,FLOWCONTROLLEDSTAFFIDLIST=%s WHERE ID=%s: ['LH', 'xebzh', 'test20240801002', datetime.datetime(2024, 8, 1, 19, 30, 18, 357469, tzinfo=<DstTzInfo 'Asia/Shanghai' CST+8:00:00 STD>), datetime.datetime(2024, 8, 1, 19, 30, 19, 56569, tzinfo=<DstTzInfo 'Asia/Shanghai' CST+8:00:00 STD>), '调用接口成功', 'success', 200, '', 2, "['014401']", '', 'sampleText', "{'content':'并发测试xebzh0801'}", '{"idtype":2,"msgKey":"sampleText","ori_chn":"LH","ori_seq":"test20240801002","ori_sys":"xebzh","userIds":["014401"],"msgParam":"{\'content\':\'并发测试 xebzh0801\'}"}', 'b9RN5kwxEtRhX7HP2KYwVRNkvmUzqMuIctZ37nvbM+Y=', '[]', '[]', '006073f9-4752-409b-aa5b-54e082267899']

@arrenanv
Copy link

arrenanv commented Aug 3, 2024

+1 here. I am also facing this issue

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

No branches or pull requests

2 participants