test article (#104)

Co-authored-by: Igor Lobanov <igor.lobanov@onetwotrip.com>
This commit is contained in:
Ilya Y 2023-11-04 19:44:58 +03:00 committed by GitHub
parent 21316187e0
commit 0da4e110c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,4 @@
import json
from datetime import datetime, timedelta, timezone
from sqlalchemy.orm import aliased, joinedload
@ -79,6 +80,15 @@ def apply_filters(q, filters, user_id=None): # noqa: C901
@query.field("loadShout")
async def load_shout(_, info, slug=None, shout_id=None):
# for testing, soon will be removed
if slug == "testtesttest":
with open("test/test.json") as json_file:
test_shout = json.load(json_file)["data"]["loadShout"]
test_shout["createdAt"] = datetime.fromisoformat(test_shout["createdAt"])
test_shout["publishedAt"] = datetime.fromisoformat(test_shout["publishedAt"])
print(test_shout)
return test_shout
with local_session() as session:
q = select(Shout).options(
joinedload(Shout.authors),

View File

@ -142,7 +142,7 @@ class NewReactionNotificator:
class NotificationService:
def __init__(self):
self._queue = asyncio.Queue()
self._queue = asyncio.Queue(maxsize=1000)
async def handle_new_reaction(self, reaction_id):
notificator = NewReactionNotificator(reaction_id)

File diff suppressed because one or more lines are too long