Skip to content

Commit

Permalink
feat: remove interval, account for rate limits
Browse files Browse the repository at this point in the history
  • Loading branch information
0x16c3 committed Oct 26, 2022
1 parent 4db11c0 commit fc75840
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
4 changes: 1 addition & 3 deletions cogs/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,6 @@ async def process(self):
await asyncio.sleep(5)
continue

await asyncio.sleep(int(config["INTERVAL"]))

no_dupes = []
[no_dupes.append(x) for x in self.feeds if x not in no_dupes]

Expand All @@ -539,7 +537,7 @@ async def process(self):
)

# wait 60 seconds after every 25 feeds to prevent rate limiting
if i % 25 == 0 and i >= 25:
if i % 28 == 0 and i >= 28:
logger.debug(f"Waiting 60 seconds.")
await asyncio.sleep(60)

Expand Down
3 changes: 0 additions & 3 deletions cogs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ def rotate_hue(color: Tuple[int, int, int], angle) -> Tuple[int, int, int]:
if not os.path.isfile("tmp/config.ini"):
fp = open("tmp/config.ini", "w")
fp.write("[DEFAULT]\n")
fp.write("; interval for recieving list updates\n")
fp.write("INTERVAL = 60\n")
fp.write("; maximum list items that a RssFeed object can contain\n")
fp.write("MEMORY_LIMIT = 25\n")
fp.write("; set this to your test server's id for the commands to update faster.\n")
Expand All @@ -209,7 +207,6 @@ def rotate_hue(color: Tuple[int, int, int], angle) -> Tuple[int, int, int]:

logger.info(
f"LOADED CONFIG:\n"
f' INTERVAL = {config["INTERVAL"]}\n'
f' MEMORY_LIMIT = {config["MEMORY_LIMIT"]}\n'
)

Expand Down

0 comments on commit fc75840

Please sign in to comment.