mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-10 19:18:57 +08:00
Fix pymysql interface error (#7295)
### What problem does this PR solve? According to the [[Rucongzhang](https://github.com/Rucongzhang)](https://github.com/infiniflow/ragflow/pull/7057#issuecomment-2827410047) I added DB reconnection strategy in function `update_by_id`
This commit is contained in:
parent
02cc867c06
commit
eead838353
@ -212,6 +212,12 @@ class CommonService:
|
||||
# data: Updated field values
|
||||
# Returns:
|
||||
# Number of records updated
|
||||
try:
|
||||
if not DB.is_connection_usable():
|
||||
DB.connect()
|
||||
except Exception:
|
||||
DB.close()
|
||||
DB.connect()
|
||||
data["update_time"] = current_timestamp()
|
||||
data["update_date"] = datetime_format(datetime.now())
|
||||
num = cls.model.update(data).where(cls.model.id == pid).execute()
|
||||
|
Loading…
x
Reference in New Issue
Block a user