This commit is contained in:
parent
774a5ee596
commit
325927739e
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -149,4 +149,4 @@ dev-server.pid
|
|||
backups/
|
||||
poetry.lock
|
||||
.ruff_cache
|
||||
dev-server.pid
|
||||
.jj
|
||||
|
|
|
@ -159,7 +159,7 @@ def topic_follow(follower_id, slug):
|
|||
topic = session.query(Topic).where(Topic.slug == slug).one()
|
||||
_following = TopicFollower(topic=topic.id, follower=follower_id)
|
||||
return True
|
||||
except Exception:
|
||||
except Exception as _exc:
|
||||
return False
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,9 @@ async def check_auth(req) -> str | None:
|
|||
}
|
||||
|
||||
gql = {
|
||||
'query': f'query {operation}($params: ValidateJWTTokenInput!) {{ {query_name}(params: $params) {{ is_valid claims }} }}',
|
||||
'query': f'query {operation}($params: ValidateJWTTokenInput!) {{' +
|
||||
f'{query_name}(params: $params) {{ is_valid claims }} ' +
|
||||
'}',
|
||||
'variables': variables,
|
||||
'operationName': operation,
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ logger = logging.getLogger('\t[services.search]\t')
|
|||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
ELASTIC_HOST = (
|
||||
os.environ.get('ELASTIC_HOST', '').replace('https://', '').replace('http://', '')
|
||||
os.environ.get('ELASTIC_HOST', '').replace('https://', '')
|
||||
)
|
||||
ELASTIC_USER = os.environ.get('ELASTIC_USER', '')
|
||||
ELASTIC_PASSWORD = os.environ.get('ELASTIC_PASSWORD', '')
|
||||
|
@ -99,8 +99,8 @@ class SearchService:
|
|||
self.client = None
|
||||
|
||||
def info(self):
|
||||
if self.client:
|
||||
logger.info(f' Поиск подключен: {self.client.host}')
|
||||
if isinstance(self.client, OpenSearch):
|
||||
logger.info(f' Поиск подключен: {self.client.info()}')
|
||||
else:
|
||||
logger.info(' * Задайте переменные среды для подключения к серверу поиска')
|
||||
|
||||
|
@ -119,8 +119,6 @@ class SearchService:
|
|||
)
|
||||
self.client.indices.close(index=self.index_name)
|
||||
self.client.indices.open(index=self.index_name)
|
||||
except Exception as _exc: # noqa: S110
|
||||
pass
|
||||
finally:
|
||||
self.lock.release()
|
||||
else:
|
||||
|
|
|
@ -197,7 +197,7 @@ class ViewedStorage:
|
|||
try:
|
||||
await self.update_pages()
|
||||
failed = 0
|
||||
except Exception:
|
||||
except Exception as _exc:
|
||||
failed += 1
|
||||
logger.info(' - Обновление не удалось #%d, ожидание 10 секунд' % failed)
|
||||
if failed > 3:
|
||||
|
|
Loading…
Reference in New Issue
Block a user