gabcares commited on
Commit
d78848a
·
verified ·
1 Parent(s): 7f14ac1

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -3
main.py CHANGED
@@ -184,10 +184,11 @@ async def sms_posts(instance: Result, idx: str = None, action: str = "add") -> U
184
  if checker:
185
  if action == "delete":
186
  await session.delete(instance)
 
187
  else: # add or update use add
188
- session.add(instance)
189
- await session.commit()
190
- await session.refresh(instance)
191
  code = 1
192
  except Exception as e:
193
  error = e
 
184
  if checker:
185
  if action == "delete":
186
  await session.delete(instance)
187
+ await session.commit()
188
  else: # add or update use add
189
+ session.add(instance) # Not asynchronous
190
+ await session.commit()
191
+ await session.refresh(instance)
192
  code = 1
193
  except Exception as e:
194
  error = e