This commit is contained in:
Untone 2024-08-07 08:57:56 +03:00
parent 1d4fa4b977
commit 60a56fd098
27 changed files with 40 additions and 40 deletions

View File

@ -7,9 +7,9 @@ from orm.author import Author, AuthorFollower
from orm.topic import Topic, TopicFollower from orm.topic import Topic, TopicFollower
from orm.shout import Shout, ShoutAuthor, ShoutTopic from orm.shout import Shout, ShoutAuthor, ShoutTopic
from services.db import local_session from services.db import local_session
from services.encoders import CustomJSONEncoder from utils.encoders import CustomJSONEncoder
from services.rediscache import redis from cache.rediscache import redis
from services.logger import root_logger as logger from utils.logger import root_logger as logger
DEFAULT_FOLLOWS = { DEFAULT_FOLLOWS = {
"topics": [], "topics": [],

View File

@ -6,11 +6,11 @@ from orm.author import Author, AuthorFollower
from orm.shout import Shout, ShoutAuthor, ShoutTopic from orm.shout import Shout, ShoutAuthor, ShoutTopic
from orm.topic import Topic, TopicFollower from orm.topic import Topic, TopicFollower
from resolvers.stat import get_with_stat from resolvers.stat import get_with_stat
from services.cache import cache_author, cache_topic from cache.cache import cache_author, cache_topic
from services.db import local_session from services.db import local_session
from services.encoders import CustomJSONEncoder from utils.encoders import CustomJSONEncoder
from services.logger import root_logger as logger from utils.logger import root_logger as logger
from services.rediscache import redis from cache.rediscache import redis
async def precache_authors_followers(author_id, session): async def precache_authors_followers(author_id, session):

View File

@ -1,6 +1,6 @@
import asyncio import asyncio
from services.logger import root_logger as logger from utils.logger import root_logger as logger
from services.cache import get_cached_author, cache_author, cache_topic, get_cached_topic from cache.cache import get_cached_author, cache_author, cache_topic, get_cached_topic
class CacheRevalidationManager: class CacheRevalidationManager:

View File

@ -3,8 +3,8 @@ from orm.author import Author, AuthorFollower
from orm.reaction import Reaction from orm.reaction import Reaction
from orm.shout import Shout, ShoutAuthor from orm.shout import Shout, ShoutAuthor
from orm.topic import Topic, TopicFollower from orm.topic import Topic, TopicFollower
from services.revalidator import revalidation_manager from cache.revalidator import revalidation_manager
from services.logger import root_logger as logger from utils.logger import root_logger as logger
def after_update_handler(mapper, connection, target): def after_update_handler(mapper, connection, target):

View File

@ -1,6 +1,6 @@
import json import json
from services.rediscache import redis from cache.rediscache import redis
async def get_unread_counter(chat_id: str, author_id: int) -> int: async def get_unread_counter(chat_id: str, author_id: int) -> int:

View File

@ -8,14 +8,14 @@ from starlette.applications import Starlette
from starlette.routing import Route from starlette.routing import Route
from services.exception import ExceptionHandlerMiddleware from services.exception import ExceptionHandlerMiddleware
from services.precache import precache_data
from services.rediscache import redis
from services.schema import resolvers from services.schema import resolvers
from services.search import search_service from services.search import search_service
from services.sentry import start_sentry from services.sentry import start_sentry
from services.viewed import ViewedStorage from services.viewed import ViewedStorage
from services.webhook import WebhookEndpoint from services.webhook import WebhookEndpoint
from services.revalidator import revalidation_manager from cache.precache import precache_data
from cache.rediscache import redis
from cache.revalidator import revalidation_manager
from settings import DEV_SERVER_PID_FILE_NAME, MODE from settings import DEV_SERVER_PID_FILE_NAME, MODE
import_module("resolvers") import_module("resolvers")

View File

@ -7,7 +7,7 @@ from sqlalchemy.orm import relationship
from orm.author import Author from orm.author import Author
from services.db import Base, engine from services.db import Base, engine
from services.logger import root_logger as logger from utils.logger import root_logger as logger
class NotificationEntity(Enumeration): class NotificationEntity(Enumeration):

View File

@ -49,7 +49,7 @@ from resolvers.topic import (
get_topics_by_author, get_topics_by_author,
get_topics_by_community, get_topics_by_community,
) )
from services.triggers import events_register from cache.triggers import events_register
events_register() events_register()

View File

@ -8,7 +8,7 @@ from orm.shout import ShoutAuthor, ShoutTopic
from orm.topic import Topic from orm.topic import Topic
from resolvers.stat import get_with_stat from resolvers.stat import get_with_stat
from services.auth import login_required from services.auth import login_required
from services.cache import ( from cache.cache import (
cache_author, cache_author,
get_cached_author, get_cached_author,
get_cached_author_by_user_id, get_cached_author_by_user_id,
@ -17,7 +17,7 @@ from services.cache import (
get_cached_follower_topics, get_cached_follower_topics,
) )
from services.db import local_session from services.db import local_session
from services.logger import root_logger as logger from utils.logger import root_logger as logger
from services.schema import mutation, query from services.schema import mutation, query

View File

@ -12,10 +12,10 @@ from orm.topic import Topic
from resolvers.follower import follow, unfollow from resolvers.follower import follow, unfollow
from resolvers.stat import get_with_stat from resolvers.stat import get_with_stat
from services.auth import login_required from services.auth import login_required
from services.cache import cache_author, cache_topic from cache.cache import cache_author, cache_topic
from services.db import local_session from services.db import local_session
from services.diff import apply_diff, get_diff from utils.diff import apply_diff, get_diff
from services.logger import root_logger as logger from utils.logger import root_logger as logger
from services.notify import notify_shout from services.notify import notify_shout
from services.schema import mutation, query from services.schema import mutation, query
from services.search import search_service from services.search import search_service

View File

@ -10,7 +10,7 @@ from orm.shout import Shout, ShoutReactionsFollower
from orm.topic import Topic, TopicFollower from orm.topic import Topic, TopicFollower
from resolvers.stat import get_with_stat from resolvers.stat import get_with_stat
from services.auth import login_required from services.auth import login_required
from services.cache import cache_author, cache_topic, get_cached_follower_authors, get_cached_follower_topics from cache.cache import cache_author, cache_topic, get_cached_follower_authors, get_cached_follower_topics
from services.db import local_session from services.db import local_session
from services.notify import notify_follower from services.notify import notify_follower
from services.schema import mutation, query from services.schema import mutation, query

View File

@ -12,7 +12,7 @@ from orm.notification import Notification, NotificationAction, NotificationEntit
from orm.shout import Shout from orm.shout import Shout
from services.auth import login_required from services.auth import login_required
from services.db import local_session from services.db import local_session
from services.logger import root_logger as logger from utils.logger import root_logger as logger
from services.schema import mutation, query from services.schema import mutation, query

View File

@ -14,7 +14,7 @@ from resolvers.follower import follow
from resolvers.stat import update_author_stat from resolvers.stat import update_author_stat
from services.auth import add_user_role, login_required from services.auth import add_user_role, login_required
from services.db import local_session from services.db import local_session
from services.logger import root_logger as logger from utils.logger import root_logger as logger
from services.notify import notify_reaction from services.notify import notify_reaction
from services.schema import mutation, query from services.schema import mutation, query
from services.viewed import ViewedStorage from services.viewed import ViewedStorage

View File

@ -19,7 +19,7 @@ from resolvers.reaction import add_reaction_stat_columns
from resolvers.topic import get_topics_random from resolvers.topic import get_topics_random
from services.auth import login_required from services.auth import login_required
from services.db import local_session from services.db import local_session
from services.logger import root_logger as logger from utils.logger import root_logger as logger
from services.schema import query from services.schema import query
from services.search import search_text from services.search import search_text
from services.viewed import ViewedStorage from services.viewed import ViewedStorage

View File

@ -7,9 +7,9 @@ from orm.author import Author, AuthorFollower
from orm.reaction import Reaction, ReactionKind from orm.reaction import Reaction, ReactionKind
from orm.shout import Shout, ShoutAuthor, ShoutTopic from orm.shout import Shout, ShoutAuthor, ShoutTopic
from orm.topic import Topic, TopicFollower from orm.topic import Topic, TopicFollower
from services.cache import cache_author from cache.cache import cache_author
from services.db import local_session from services.db import local_session
from services.logger import root_logger as logger from utils.logger import root_logger as logger
def add_topic_stat_columns(q): def add_topic_stat_columns(q):

View File

@ -5,10 +5,10 @@ from orm.shout import ShoutTopic
from orm.topic import Topic from orm.topic import Topic
from resolvers.stat import get_with_stat from resolvers.stat import get_with_stat
from services.auth import login_required from services.auth import login_required
from services.cache import get_cached_topic_authors, get_cached_topic_by_slug, get_cached_topic_followers from cache.cache import get_cached_topic_authors, get_cached_topic_by_slug, get_cached_topic_followers
from services.db import local_session from services.db import local_session
from services.logger import root_logger as logger from utils.logger import root_logger as logger
from services.memorycache import cache_region from cache.memorycache import cache_region
from services.schema import mutation, query from services.schema import mutation, query

View File

@ -3,7 +3,7 @@ import subprocess
from granian.constants import Interfaces from granian.constants import Interfaces
from granian.server import Granian from granian.server import Granian
from services.logger import root_logger as logger from utils.logger import root_logger as logger
from settings import PORT from settings import PORT

View File

@ -3,8 +3,8 @@ from functools import wraps
import httpx import httpx
from resolvers.stat import get_with_stat from resolvers.stat import get_with_stat
from services.cache import get_cached_author_by_user_id from cache.cache import get_cached_author_by_user_id
from services.logger import root_logger as logger from utils.logger import root_logger as logger
from settings import ADMIN_SECRET, AUTH_URL from settings import ADMIN_SECRET, AUTH_URL

View File

@ -10,7 +10,7 @@ from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import Session, configure_mappers from sqlalchemy.orm import Session, configure_mappers
from sqlalchemy.sql.schema import Table from sqlalchemy.sql.schema import Table
from services.logger import root_logger as logger from utils.logger import root_logger as logger
from settings import DB_URL from settings import DB_URL
# from sqlalchemy_searchable import make_searchable # from sqlalchemy_searchable import make_searchable

View File

@ -2,8 +2,8 @@ import json
from orm.notification import Notification from orm.notification import Notification
from services.db import local_session from services.db import local_session
from services.logger import root_logger as logger from utils.logger import root_logger as logger
from services.rediscache import redis from cache.rediscache import redis
def save_notification(action: str, entity: str, payload): def save_notification(action: str, entity: str, payload):

View File

@ -5,8 +5,8 @@ import os
from opensearchpy import OpenSearch from opensearchpy import OpenSearch
from services.encoders import CustomJSONEncoder from utils.encoders import CustomJSONEncoder
from services.rediscache import redis from cache.rediscache import redis
# Set redis logging level to suppress DEBUG messages # Set redis logging level to suppress DEBUG messages
logger = logging.getLogger("search") logger = logging.getLogger("search")

View File

@ -10,7 +10,7 @@ from starlette.responses import JSONResponse
from orm.author import Author from orm.author import Author
from resolvers.stat import get_with_stat from resolvers.stat import get_with_stat
from services.cache import cache_author from cache.cache import cache_author
from services.db import local_session from services.db import local_session