From 4a77e764a6bd0b7c9b9d3a5c38983248e7f67621 Mon Sep 17 00:00:00 2001 From: Caleb Johnson Date: Wed, 29 Nov 2017 14:46:37 -0600 Subject: [PATCH] [Alias] Change message deepcopy to shallow copy (#1053) For extremely large servers (tens of thousands of members), copying the Server object can take several seconds and peg the CPU since this is a necessarily blocking operation --- cogs/alias.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cogs/alias.py b/cogs/alias.py index 6c23fcb2d..62aea80a9 100644 --- a/cogs/alias.py +++ b/cogs/alias.py @@ -3,7 +3,7 @@ from .utils.chat_formatting import box from .utils.dataIO import dataIO from .utils import checks from __main__ import user_allowed, send_cmd_help -from copy import deepcopy +from copy import copy import os import discord @@ -126,7 +126,7 @@ class Alias: if alias in self.aliases[server.id]: new_command = self.aliases[server.id][alias] args = message.content[len(prefix + alias):] - new_message = deepcopy(message) + new_message = copy(message) new_message.content = prefix + new_command + args await self.bot.process_commands(new_message)