I want Jupyter Notebook to automatically restart the kernel and Run All [cells] after n milliseconds if a successful execution is not True

I build this application to help me learn math faster:
https://github.com/NSC9/Sample_of_Work/blob/5f93c6dc859769824530938deec64533c10a53d3/mathematics.ipynb

Rather than understanding why the kernel crashes every 100 executions and requires me to manually restart the kernel and Run All, why isn’t there a feature that lets me specify: “if my notebook does not execute successfully within n milliseconds (say 2 seconds), then the notebook will automatically restart kernel/run all with the same check.”