pR0Ps / slack-to-discord

Import a Slack export into a Discord server
https://pypi.org/project/slack-to-discord/
78 stars 11 forks source link

Maximum number of active threads reached #16

Closed benishs closed 2 years ago

benishs commented 2 years ago

I got this error yesterday after importing a bunch of channels & messages – I tried again today and it imported some messages, but didn't even get through an entire channel before it happened again:

2022-10-09 11:26:01 CRITICAL slack_to_discord Failed to finish import! Traceback (most recent call last): File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/slack_to_discord.py", line 420, in on_ready await self._run_import(g) File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/slack_to_discord.py", line 525, in _run_import thread = await sent.create_thread(name=thread_name) File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/discord/message.py", line 1208, in create_thread data = await self._state.http.start_thread_with_message( File "/Users/benishs/opt/anaconda3/lib/python3.8/site-packages/discord/http.py", line 744, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 160006): Maximum number of active threads reached

Any ideas?

Thanks,

Scott

benishs commented 2 years ago

Just tried again and it again started the import, but gave the same error even quicker than before – didn't even get through one day's of messages this time.

pR0Ps commented 2 years ago

Huh, I guess there are limits on the number of threaded conversations that can be active at once.

This can most likely be fixed by having the bot archive threads automatically after it finishes importing them.

benishs commented 2 years ago

Hmm. This person says the limit is 1,000, but this person says the limit is 100 per guild/server.

My Discord says "103 other active threads" in the thread notification area for the channel where it failed, but it seems that number (103) is the number of active threads for the channel, not the guild/server. I have another recently imported channel with 262 active threads, so my guess is with all the imports I'm hitting that 1,000 active thread limit for the guild/server.

That would explain why it worked for a bit earlier this morning, and then only very briefly when I tried again later. A few of the threads from yesterday's importing probably auto-archived after 24 hours, which let me import a few more before it hit the limit again?

pR0Ps commented 2 years ago

Should be fixed as of the latest commit. pip uninstall slack-to-discord then pip install git+https://github.com/pR0Ps/slack-to-discord should get you the latest version to test with.

benishs commented 2 years ago

Installed the latest and finished my import!

I think all the old active threads in my guild had gone inactive, but I confirmed that the threads in newly imported channels have been closed by the bot so it certainly seems like this should solve the problem. Thanks for the quick fix!