Skip to content

Commit

Permalink
fix var template
Browse files Browse the repository at this point in the history
  • Loading branch information
PhoenixNazarov committed Aug 10, 2024
1 parent d68046c commit 4dc87df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions library/promptadmin/vars/var_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def create(self, key: str, value: str, template: bool):
logger.error('Error connection database for get vars', exc_info=e)
return

await conn.fetch(f'INSERT INTO pa_var (key, value, template) VALUES (\'{key}\', \'{value}\', \'{template}\')')
await conn.fetch('INSERT INTO pa_var (key, value, template) VALUES ($1, $2, $3)', key, value, template)

async def change(self, key: str, value: str):
try:
Expand All @@ -94,7 +94,7 @@ async def change(self, key: str, value: str):
logger.error('Error connection database for get vars', exc_info=e)
return

await conn.fetch(f'UPDATE pa_var SET value=\'{value}\' WHERE key=\'{key}\'')
await conn.fetch('UPDATE pa_var SET value=$1 WHERE key=$2', value, key)

async def remove(self, key: str):
try:
Expand All @@ -103,4 +103,4 @@ async def remove(self, key: str):
logger.error('Error connection database for get vars', exc_info=e)
return

await conn.fetch(f'DELETE FROM pa_var WHERE key=\'{key}\'')
await conn.fetch('DELETE FROM pa_var WHERE key=$1', key)
2 changes: 1 addition & 1 deletion server/promptadmin_server/api/job/unit_test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self,
self.mapping_entity_service = mapping_entity_service or MappingEntityService()

async def start(self):
# await asyncio.sleep(60 * 10)
await asyncio.sleep(60 * 10)
while True:
sync_datas = await self.sync_data_service.find_all()
for i in sync_datas:
Expand Down

0 comments on commit 4dc87df

Please sign in to comment.