inbox-debug-3
This commit is contained in:
parent
6e8c084816
commit
a83ef022a3
8
main.py
8
main.py
|
@ -20,6 +20,7 @@ schema = make_executable_schema(load_schema_from_path("inbox.graphql"), resolver
|
||||||
|
|
||||||
|
|
||||||
async def start_up():
|
async def start_up():
|
||||||
|
try:
|
||||||
await redis.connect()
|
await redis.connect()
|
||||||
|
|
||||||
await CacheStorage.init()
|
await CacheStorage.init()
|
||||||
|
@ -30,7 +31,6 @@ async def start_up():
|
||||||
f.write(str(os.getpid()))
|
f.write(str(os.getpid()))
|
||||||
else:
|
else:
|
||||||
# startup sentry monitoring services
|
# startup sentry monitoring services
|
||||||
try:
|
|
||||||
import sentry_sdk
|
import sentry_sdk
|
||||||
|
|
||||||
sentry_sdk.init(
|
sentry_sdk.init(
|
||||||
|
@ -43,8 +43,10 @@ async def start_up():
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("[sentry] init error")
|
print("STARTUP FAILED")
|
||||||
print(e)
|
import traceback
|
||||||
|
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
|
||||||
async def shutdown():
|
async def shutdown():
|
||||||
|
|
|
@ -94,7 +94,7 @@ async def load_chats(_, info, limit: int = 50, offset: int = 0) -> Dict[str, Uni
|
||||||
member_ids = c["members"].copy()
|
member_ids = c["members"].copy()
|
||||||
c["members"] = []
|
c["members"] = []
|
||||||
for member_id in member_ids:
|
for member_id in member_ids:
|
||||||
a = CacheStorage.authors_by_id.get(member_id)
|
a = CacheStorage.authors_by_id.get(str(member_id))
|
||||||
if a:
|
if a:
|
||||||
a["online"] = a.get("id") in members_online
|
a["online"] = a.get("id") in members_online
|
||||||
c["members"].append(a)
|
c["members"].append(a)
|
||||||
|
|
|
@ -25,7 +25,7 @@ async def search_recipients(_, info, text: str, limit: int = 50, offset: int = 0
|
||||||
members_ids = await redis.execute("SMEMBERS", f"/chats/{chat_id}/members")
|
members_ids = await redis.execute("SMEMBERS", f"/chats/{chat_id}/members")
|
||||||
if isinstance(members_ids, set):
|
if isinstance(members_ids, set):
|
||||||
for member_id in members_ids:
|
for member_id in members_ids:
|
||||||
author = CacheStorage.authors_by_id.get(member_id)
|
author = CacheStorage.authors_by_id.get(str(member_id))
|
||||||
if author:
|
if author:
|
||||||
if author["name"].startswith(text):
|
if author["name"].startswith(text):
|
||||||
result.add(author)
|
result.add(author)
|
||||||
|
|
|
@ -94,7 +94,7 @@ class CacheStorage:
|
||||||
CacheStorage.authors = result
|
CacheStorage.authors = result
|
||||||
for a in result:
|
for a in result:
|
||||||
user_id = a.get("user")
|
user_id = a.get("user")
|
||||||
author_id = a.get("id")
|
author_id = str(a.get("id"))
|
||||||
self.authors_by_user[user_id] = a
|
self.authors_by_user[user_id] = a
|
||||||
self.authors_by_id[author_id] = a
|
self.authors_by_id[author_id] = a
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user