0

I am making a discord bot and in it, I am trying to implement an integration command. For this, I am using the sympy module. However, the sympy module is synchronous and would block the program till a calculation is completed which is pretty bad for a bot.

To integrate, I am using the following code:

from sympy import *

x = Symbols("x")
result = integrate(expression) # Expression is user inputed
# Send the result

So how do I ensure that if a calculation takes more than say 5 seconds, it should automatically close down? Or is there any better async alternative library that I can use?

luciferchase
  • 559
  • 1
  • 10
  • 24

0 Answers0