Auto-update: Mon Aug 12 22:55:12 PDT 2024
This commit is contained in:
parent
36b2578265
commit
426844f928
1 changed files with 14 additions and 4 deletions
|
@ -270,6 +270,17 @@ class Database:
|
||||||
for query in unexecuted_queries:
|
for query in unexecuted_queries:
|
||||||
try:
|
try:
|
||||||
params = json.loads(query.args)
|
params = json.loads(query.args)
|
||||||
|
|
||||||
|
# Convert string datetime to datetime objects
|
||||||
|
for key, value in params.items():
|
||||||
|
if isinstance(value, str) and value.endswith(('Z', '+00:00')):
|
||||||
|
try:
|
||||||
|
params[key] = datetime.fromisoformat(value.rstrip('Z'))
|
||||||
|
except ValueError:
|
||||||
|
# If conversion fails, leave the original value
|
||||||
|
pass
|
||||||
|
|
||||||
|
async with session.begin():
|
||||||
await session.execute(text(query.query), params)
|
await session.execute(text(query.query), params)
|
||||||
query.completed_by = list(set(query.completed_by + [self.local_ts_id]))
|
query.completed_by = list(set(query.completed_by + [self.local_ts_id]))
|
||||||
await session.commit()
|
await session.commit()
|
||||||
|
@ -279,7 +290,6 @@ class Database:
|
||||||
await session.rollback()
|
await session.rollback()
|
||||||
l.info("Finished executing unexecuted queries")
|
l.info("Finished executing unexecuted queries")
|
||||||
|
|
||||||
|
|
||||||
async def call_db_sync_on_servers(self):
|
async def call_db_sync_on_servers(self):
|
||||||
"""Call /db/sync on all online servers."""
|
"""Call /db/sync on all online servers."""
|
||||||
online_servers = await self.get_online_servers()
|
online_servers = await self.get_online_servers()
|
||||||
|
|
Loading…
Reference in a new issue