use the multiprocessing pool for the /mcimage command
@@ -102,9 +102,8 @@ class Minecraft(commands.Cog):
detailed = "large" in ctx.message.content or "high" in ctx.message.content
with ctx.typing():
- with ThreadPoolExecutor() as pool:
mosaic_gen_partial = functools.partial(mosaic.generate, await img.read(use_cached=True), 1600, detailed)
- _, img_bytes = await self.bot.loop.run_in_executor(pool, mosaic_gen_partial)
+ _, img_bytes = await self.bot.loop.run_in_executor(self.bot.ppool, mosaic_gen_partial)
filename = f"tmp/{ctx.message.id}-{img.width}x{img.height}.png"
