Auto-update: Tue Jul 30 15:22:09 PDT 2024

This commit is contained in:
sanj 2024-07-30 15:22:09 -07:00
parent d7020c2a0a
commit d2e54009e0

View file

@ -655,7 +655,8 @@ 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
async with conn.transaction():
affected_rows = 0 affected_rows = 0
for change in changes: for change in changes:
values = [change[col] for col in columns] values = [change[col] for col in columns]
@ -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'):