From 419ed61dd38c6a8e468448ff76e08df8556ef12d Mon Sep 17 00:00:00 2001 From: justcool393 Date: Fri, 14 Oct 2022 11:46:39 -0700 Subject: [PATCH 1/4] discord ids as constants --- files/helpers/const.py | 2 ++ files/helpers/discord.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 0a9295eb4..cc66473d2 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -156,6 +156,8 @@ AGENDAPOSTER_MSG_HTML = """

Hi here.

""" +DISCORD_CHANGELOG_CHANNEL_IDS = [924485611715452940, 1013992002624426015] +WPD_CHANNEL_ID = 1013990963846332456 ################################################################################ ### SITE SPECIFIC CONSTANTS diff --git a/files/helpers/discord.py b/files/helpers/discord.py index dd72bb077..7fe8ce844 100644 --- a/files/helpers/discord.py +++ b/files/helpers/discord.py @@ -46,9 +46,9 @@ def set_nick(user, nick): def send_changelog_message(message): data={"content": message} - requests.post("https://discordapp.com/api/channels/924485611715452940/messages", headers=headers, data=data, timeout=5) - requests.post("https://discordapp.com/api/channels/1013992002624426015/messages", headers=headers, data=data, timeout=5) + for id in DISCORD_CHANGELOG_CHANNEL_IDS: + requests.post(f"https://discordapp.com/api/channels/{id}/messages", headers=headers, data=data, timeout=5) def send_wpd_message(message): data={"content": message} - requests.post("https://discordapp.com/api/channels/1013990963846332456/messages", headers=headers, data=data, timeout=5) + requests.post(f"https://discordapp.com/api/channels/{WPD_CHANNEL_ID}/messages", headers=headers, data=data, timeout=5) From b6703595da470e25c39ca0aea53ee0cf0f7dd9df Mon Sep 17 00:00:00 2001 From: TLSM Date: Fri, 14 Oct 2022 15:34:20 -0400 Subject: [PATCH 2/4] Revert "make 819.webp the only sidebar image for a couple of days to hopefully piss off someone" This reverts commit d244124d47c6d998134abf4871f557603f350d9b. It's been a few days, reverted upon Carp request. --- files/templates/sidebar_rDrama.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/templates/sidebar_rDrama.html b/files/templates/sidebar_rDrama.html index eedcf2197..534da3e36 100644 --- a/files/templates/sidebar_rDrama.html +++ b/files/templates/sidebar_rDrama.html @@ -13,8 +13,8 @@ sidebar image {% elif not (sub and sub.name == 'chudrama' and v.truecoins < 5000) %} - - sidebar image + + sidebar image {% endif %} {% endif %} From 683d56205831387d9a19842d36ee2ff465b73580 Mon Sep 17 00:00:00 2001 From: TLSM Date: Fri, 14 Oct 2022 17:41:26 -0400 Subject: [PATCH 3/4] Fix pruning of {SITE}_loggedin/out dicts. For the past week, we noticed a gradual increase in CPU usage and request times. Use of a sampling profiler revealed the time waas spent in serializing/deserializing data stored in Redis. In particular, the user counter dicts were filtered for calculation of the loggedin/out counters, but the filtered versions were never stored. To make concurrency safe, we still filter on every request, but at least the resting data will eventually be appropriately filtered, and this data is non-critical regardless. --- files/helpers/wrappers.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index 5a5e1d9dc..be768eef3 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -52,9 +52,6 @@ def get_logged_in_user(): loggedin = cache.get(f'{SITE}_loggedin') or {} loggedout = cache.get(f'{SITE}_loggedout') or {} - g.loggedin_counter = 0 - g.loggedout_counter = 0 - timestamp = int(time.time()) if v: if session["session_id"] in loggedout: del loggedout[session["session_id"]] @@ -69,12 +66,14 @@ def get_logged_in_user(): if 'spider' not in ua.lower() and 'bot' not in ua.lower(): loggedout[session["session_id"]] = (timestamp, ua) - g.loggedin_counter = len([x for x in loggedin.values() if timestamp-x < LOGGEDIN_ACTIVE_TIME]) + loggedin = {k: v for k, v in loggedin.items() if (timestamp - v) < LOGGEDIN_ACTIVE_TIME} + loggedout = {k: v for k, v in loggedout.items() if (timestamp - v[0]) < LOGGEDIN_ACTIVE_TIME} cache.set(f'{SITE}_loggedin', loggedin) - - g.loggedout_counter = len([x for x in loggedout.values() if timestamp-x[0] < LOGGEDIN_ACTIVE_TIME]) cache.set(f'{SITE}_loggedout', loggedout) + g.loggedin_counter = len(loggedin) + g.loggedout_counter = len(loggedout) + g.v = v if v: v.poor = session.get('poor') From e886d272703d1e41eab442cea4d3f12c0caae878 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 15 Oct 2022 00:00:05 +0000 Subject: [PATCH 4/4] sneed --- seed-db.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/seed-db.sql b/seed-db.sql index ee2806e5e..2927c7ef6 100644 --- a/seed-db.sql +++ b/seed-db.sql @@ -1254,6 +1254,7 @@ INSERT INTO public.marseys (name, author_id, tags, created_utc) VALUES ('marseyben10',2,'ten anime cartoon lawlz',NULL), ('marseybestfriends',2,'snoo reddit alien slice kill kys stab blood wpd',NULL), ('marseybetauprising',2,'blackops2cel blops2cel incel volcel lasereyes dark involuntary celibate saint',1663213986), +('marseybiast',2,'darrell brooks court biased biast',1665784922), ('marseybiden',2,'ddd dementia daddy president sleepy joe',NULL), ('marseybiden2',2,'biden ddd dementia daddy president sleepy joe gas petrol ididthat',NULL), ('marseybigbrain',2,'high iq highiq smart genius brain',NULL), @@ -1945,6 +1946,7 @@ INSERT INTO public.marseys (name, author_id, tags, created_utc) VALUES ('marseyjumpscare',2,'undead living dead romero halloween horror corpse scary rotten animated spooky aaaahhhhh trick prank bait and switch',NULL), ('marseyjunkie',2,'needles heroin reaction shooting up addicted shoot up syringe',NULL), ('marseyjunkie2',2,'addicted drugs pills glue huffing ether overdose',NULL), +('marseyjurisdiction',2,'darrell brooks court subject matter jurisdiction',1665785047), ('marseykaiser',2,'prussian history wwi rifle reich wilhelm germany soldier',NULL), ('marseykamikaze',2,'kamikaze japanese nip pilot ww2 wwii world war',NULL), ('marseykatamarireddit',2,'rolling animated vidya video game damaci damacy reddit',NULL), @@ -2374,6 +2376,7 @@ INSERT INTO public.marseys (name, author_id, tags, created_utc) VALUES ('marseyreindeer2',2,'santa christmas rudolf holiday',NULL), ('marseyreindeer3',2,'rudolf dasher dancer prancer vixen comet cupid donner blitzen santa sleigh sled christmas winter holiday',NULL), ('marseyreindeer4',2,'rudolf dasher dancer prancer vixen comet cupid donner blitzen santa sleigh sled christmas winter holiday',NULL), +('marseyrelevancy',2,'darrell brooks court relevancy relevance',1665785008), ('marseyreluctant',2,'stare doubt skeptical wary cautious uncertain uhh umm',NULL), ('marseyremastered',2,'4k hd hi def hidef high definition uhd rtx',NULL), ('marseyrentfree',2,'reaction no charge obsessed obsession',NULL), @@ -2645,6 +2648,7 @@ INSERT INTO public.marseys (name, author_id, tags, created_utc) VALUES ('marseysylveon',2,'trick or treat pokemon halloween eevee costume holiday',NULL), ('marseytabletired',2,'tiresome depressed sad desk',NULL), ('marseytabletired2',2,'beer tiresome depressed sad alcoholic alcoholism despair',NULL), +('marseytakit',2,'darrell brooks court takit tacit agreement',1665785068), ('marseytaliban',2,'mujahideen janniejihad islam afganistan shariah afghanistan muslim',NULL), ('marseytalking',2,'speech bubble smug gossip',NULL), ('marseytampon',2,'period menstrual menses menstruation bloody',NULL),