This commit is contained in:
parent
48b8209e23
commit
da3e7e55fd
|
@ -144,7 +144,6 @@ async def update_shout(_, info, shout_id, shout_input=None, publish=False):
|
||||||
session.add(shout)
|
session.add(shout)
|
||||||
|
|
||||||
# main topic
|
# main topic
|
||||||
# TODO: test main_topic update
|
|
||||||
if "main_topic" in shout_input:
|
if "main_topic" in shout_input:
|
||||||
old_main_topic = (
|
old_main_topic = (
|
||||||
session.query(ShoutTopic)
|
session.query(ShoutTopic)
|
||||||
|
|
|
@ -272,13 +272,9 @@ async def update_reaction(_, info, rid, reaction):
|
||||||
r.body = body
|
r.body = body
|
||||||
r.updated_at = int(time.time())
|
r.updated_at = int(time.time())
|
||||||
if r.kind != reaction["kind"]:
|
if r.kind != reaction["kind"]:
|
||||||
# NOTE: change mind detection can be here
|
# TODO: change mind detection can be here
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# FIXME: range is not stable after body editing
|
|
||||||
if reaction.get("range"):
|
|
||||||
r.range = reaction.get("range")
|
|
||||||
|
|
||||||
session.commit()
|
session.commit()
|
||||||
r.stat = {
|
r.stat = {
|
||||||
"commented": commented_stat,
|
"commented": commented_stat,
|
||||||
|
|
|
@ -288,7 +288,7 @@ async def load_shouts_search(_, _info, text, limit=50, offset=0):
|
||||||
if text and len(text) > 2:
|
if text and len(text) > 2:
|
||||||
results = await SearchService.search(text, limit, offset)
|
results = await SearchService.search(text, limit, offset)
|
||||||
results_dict = {r["slug"]: r for r in results}
|
results_dict = {r["slug"]: r for r in results}
|
||||||
print(results_dict)
|
# print(results_dict)
|
||||||
|
|
||||||
q = (
|
q = (
|
||||||
select(Shout)
|
select(Shout)
|
||||||
|
@ -302,7 +302,7 @@ async def load_shouts_search(_, _info, text, limit=50, offset=0):
|
||||||
shouts_data = []
|
shouts_data = []
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
results = list(session.execute(q).unique())
|
results = list(session.execute(q).unique())
|
||||||
print(results)
|
# print(results)
|
||||||
print(f"[resolvers.reader] searched, preparing {len(results)} results")
|
print(f"[resolvers.reader] searched, preparing {len(results)} results")
|
||||||
for x in results:
|
for x in results:
|
||||||
shout = x[0]
|
shout = x[0]
|
||||||
|
|
|
@ -28,9 +28,9 @@ def before_cursor_execute(conn, cursor, statement, parameters, context, executem
|
||||||
@event.listens_for(Engine, "after_cursor_execute")
|
@event.listens_for(Engine, "after_cursor_execute")
|
||||||
def after_cursor_execute(conn, cursor, statement, parameters, context, executemany):
|
def after_cursor_execute(conn, cursor, statement, parameters, context, executemany):
|
||||||
total = time.time() - conn.info["query_start_time"].pop(-1)
|
total = time.time() - conn.info["query_start_time"].pop(-1)
|
||||||
total = math.floor(total * 10000) / 10
|
total = math.floor(total * 10000) / 10000
|
||||||
if total > 35:
|
if total > 35:
|
||||||
print(f"\n{statement}\n----------------- Finished in {total} ms ")
|
print(f"\n{statement}\n----------------- Finished in {total} s ")
|
||||||
|
|
||||||
|
|
||||||
engine = create_engine(DB_URL, echo=False, pool_size=10, max_overflow=20)
|
engine = create_engine(DB_URL, echo=False, pool_size=10, max_overflow=20)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user