diff --git a/files/helpers/cron.py b/files/helpers/cron.py index 59f6a8c87..d2ac4df4a 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -118,6 +118,7 @@ def _sub_inactive_purge_task(): for x in to_delete: g.db.delete(x) + g.db.flush() #Necessary, following deletion errors out otherwise for x in dead_holes: g.db.delete(x) diff --git a/files/routes/login.py b/files/routes/login.py index 270936904..4db9c7c01 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -321,6 +321,8 @@ def sign_up_post(v:Optional[User]): g.db.add(new_user) + g.db.flush() + if ref_id: ref_user = get_account(ref_id) diff --git a/files/routes/routehelpers.py b/files/routes/routehelpers.py index 00333f0ef..fb1bd4686 100644 --- a/files/routes/routehelpers.py +++ b/files/routes/routehelpers.py @@ -52,6 +52,7 @@ def add_alt(user1:int, user2:int): if not existing: new_alt = Alt(user1=user1, user2=user2) g.db.add(new_alt) + g.db.flush() cache.delete_memoized(get_alt_graph_ids, user1) cache.delete_memoized(get_alt_graph_ids, user2) @@ -79,7 +80,7 @@ def check_for_alts(current:User, include_current_session=False): past_accs.add(current_id) if include_current_session: session["history"] = list(past_accs) - + g.db.flush() for u in get_alt_graph(current.id): if u.shadowbanned and not current.shadowbanned: current.shadowbanned = u.shadowbanned diff --git a/files/routes/subs.py b/files/routes/subs.py index 4635b9d83..c83130764 100644 --- a/files/routes/subs.py +++ b/files/routes/subs.py @@ -388,6 +388,7 @@ def create_sub2(v): sub = Sub(name=name) g.db.add(sub) + g.db.flush() #Necessary, following statement errors out otherwise mod = Mod(user_id=v.id, sub=sub.name) g.db.add(mod)