Auto-update: Tue Jul 30 15:22:09 PDT 2024
This commit is contained in:
parent
20d03c8867
commit
c92db52706
1 changed files with 8 additions and 6 deletions
|
@ -655,12 +655,13 @@ class APIConfig(BaseModel):
|
||||||
{', '.join(f"{col} = EXCLUDED.{col}" for col in columns if col != 'id')}
|
{', '.join(f"{col} = EXCLUDED.{col}" for col in columns if col != 'id')}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Execute the insert for each change
|
# Execute the insert for all changes in a single transaction
|
||||||
affected_rows = 0
|
async with conn.transaction():
|
||||||
for change in changes:
|
affected_rows = 0
|
||||||
values = [change[col] for col in columns]
|
for change in changes:
|
||||||
result = await conn.execute(insert_query, *values)
|
values = [change[col] for col in columns]
|
||||||
affected_rows += int(result.split()[-1])
|
result = await conn.execute(insert_query, *values)
|
||||||
|
affected_rows += int(result.split()[-1])
|
||||||
|
|
||||||
return affected_rows
|
return affected_rows
|
||||||
|
|
||||||
|
@ -670,6 +671,7 @@ class APIConfig(BaseModel):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def push_changes_to_all(self):
|
async def push_changes_to_all(self):
|
||||||
for pool_entry in self.POOL:
|
for pool_entry in self.POOL:
|
||||||
if pool_entry['ts_id'] != os.environ.get('TS_ID'):
|
if pool_entry['ts_id'] != os.environ.get('TS_ID'):
|
||||||
|
|
Loading…
Add table
Reference in a new issue