# Buggy code
def restart(self, interval=None, repeats=None, start_delay=None):
    """
    Restarts an already existing/running Script from the
    beginning, optionally using different settings. This will
    first call the stop hooks, and then the start hooks again.
    Args:
        interval (int, optional): Allows for changing the interval
            of the Script. Given in seconds.  if `None`, will use the
        repeats (int, optional): The number of repeats. If unset, will
            use the previous setting.
        start_delay (bool, optional): If we should wait `interval` seconds
            before starting or not. If `None`, re-use the previous setting.

    """
    try:
        self.at_stop()
    except Exception:
        logger.log_trace()
    self._stop_task()
    self.is_active = False
    # remove all pause flags
    del self.db._paused_time
    del self.db._manual_pause
    del self.db._paused_callcount
    # set new flags and start over
    if interval is not None:
        if interval < 0:
            interval = 0
        self.interval = interval
    if repeats is not None:
        self.repeats = repeats
    if start_delay is not None:
        self.start_delay = start_delay
    self.start()


# Traceback (builtins.ZeroDivisionError)
20-01-27 20:45:33 Unhandled error in Deferred:
20-01-27 20:45:33 Unhandled Error
Traceback (most recent call last):
File "/home/ubuntu/CLOWN/lib/python3.7/site-packages/twisted/internet/defer.py", line 151, in maybeDeferred
result = f(*args, **kw)
File "/home/ubuntu/workspace/evennia/evennia/server/amp_client.py", line 236, in server_receive_adminportal2server
server_sessionhandler.server.shutdown(mode="reload")
File "/home/ubuntu/CLOWN/lib/python3.7/site-packages/twisted/internet/defer.py", line 1613, in unwindGenerator
return _cancellableInlineCallbacks(gen)
File "/home/ubuntu/CLOWN/lib/python3.7/site-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks
_inlineCallbacks(None, g, status)
--- <exception caught here> ---
File "/home/ubuntu/CLOWN/lib/python3.7/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
result = g.send(result)
File "/home/ubuntu/workspace/evennia/evennia/server/server.py", line 418, in shutdown
for s in ScriptDB.get_all_cached_instances()
File "/home/ubuntu/workspace/evennia/evennia/server/server.py", line 419, in <listcomp>
if s.is_active or s.attributes.has("_manual_pause")
File "/home/ubuntu/workspace/evennia/evennia/scripts/scripts.py", line 517, in pause
self.db._paused_time = task.next_call_time()
File "/home/ubuntu/workspace/evennia/evennia/scripts/scripts.py", line 141, in next_call_time
return interval - (total_runtime % self.interval)
builtins.ZeroDivisionError: float modulo

# Fixed code
def restart(self, interval=None, repeats=None, start_delay=None):
    """
    Restarts an already existing/running Script from the
    beginning, optionally using different settings. This will
    first call the stop hooks, and then the start hooks again.
    Args:
        interval (int, optional): Allows for changing the interval
            of the Script. Given in seconds.  if `None`, will use the already stored interval.
        repeats (int, optional): The number of repeats. If unset, will
            use the previous setting.
        start_delay (bool, optional): If we should wait `interval` seconds
            before starting or not. If `None`, re-use the previous setting.

    """
    try:
        self.at_stop()
    except Exception:
        logger.log_trace()
    self._stop_task()
    self.is_active = False
    # remove all pause flags
    del self.db._paused_time
    del self.db._manual_pause
    del self.db._paused_callcount
    # set new flags and start over
    if interval is not None:
        if interval < 0:
            interval = 0
        self.interval = interval
    if repeats is not None:
        self.repeats = repeats
    if start_delay is not None:
        self.start_delay = start_delay
    self.start()