diff options
Diffstat (limited to '1_graph.py')
-rw-r--r-- | 1_graph.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/1_graph.py b/1_graph.py index 824d723..e2de90d 100644 --- a/1_graph.py +++ b/1_graph.py @@ -1,5 +1,6 @@ import json import sys +import time from collections import namedtuple from functools import cache from pathlib import Path @@ -26,6 +27,7 @@ cur = conn.execute( [user_id], ) while rows := cur.fetchmany(0xFF): + time.sleep(0.0001) for row in rows: note_ids.add(row[0]) if early_exit and len(note_ids) > early_exit: @@ -34,6 +36,7 @@ while rows := cur.fetchmany(0xFF): @cache def get_note(id: str) -> Note: + time.sleep(0.0001) return Note( *conn.execute( 'select "renoteId", "replyId", "userId" from note where id = %s', [id] @@ -102,6 +105,7 @@ def traverse(tree: Tree): def expand(tree: Tree): + time.sleep(0.0001) for row in conn.execute( "select id from note_replies(%s, 1, 1000)", [tree.id] ).fetchall(): |