I have the following code:
from discord.ext import commands
bot = commands.Bot(command_prefix= prefix)
big_var = {}
@bot.command(name='func1')
@commands.max_concurrency(1, wait = True)
async def func1(ctx):
func1code(big_var)
bot.run(TOKEN)
I want to run a function clear_data(big_var)
if the last use of big_var
was X minutes ago, in order to save memory.
I tried:
from discord.ext import commands
bot = commands.Bot(command_prefix= prefix)
big_var = {}
@bot.command(name='func1')
@commands.max_concurrency(1, wait = True)
async def func1(ctx):
func1code(big_var)
await asyncio.sleep(600)
clear_data(big_var)
bot.run(TOKEN)
But this prevents the function func1()
from finishing and the max_concurrency
decorator will only allow 1 instance of func1()
to be running at a time.
How can I resolve this issue?
EDIT: Rewrote question to make it more clear