Skip to content

Commit

Permalink
[Reddit] Some more minor touchups increase max_wait time for new redd…
Browse files Browse the repository at this point in the history
…it posts ideally free up some event loop space, 16 seconds is way too short a time
  • Loading branch information
TrustyJAID committed Mar 15, 2021
1 parent b4c2d9c commit 4757158
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions reddit/reddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def initialize(self):
client_secret=keys["client_secret"],
password=keys["password"],
username=keys["username"],
user_agent=f"TrustyCogs/{self.__version__} on {self.bot.user}",
user_agent=f"Trusty-cogs/{self.__version__} on {self.bot.user}",
)
log.debug("Logged into Reddit.")
except Exception:
Expand All @@ -96,7 +96,8 @@ async def _run_subreddit_stream(self, subreddit: Subreddit):
new posts as an event.
"""
try:
async for submission in subreddit.new.stream(skip_existing=True):
stream = subreddit.new.stream(skip_existing=True, max_wait=300)
async for submission in stream:
self.bot.dispatch("reddit_post", subreddit, submission)
except aiohttp.ContentTypeError:
log.debug("Stream recieved incorrect data type.")
Expand Down

0 comments on commit 4757158

Please sign in to comment.