Shreyas arya

Generation

generate functionThu, 09 Feb 2023

Number of retries = 3 The total duration of all attempts doesn't exceed 10 seconds.

def retry_func(retries): def decorator(func): def wrapped(arg): for i in range(retries): func(arg) if i % 3 == 0: sleep(3) return wrapped return decorator @retry_func(3) def func(arg): print(arg) func(1)

Questions about programming?Chat with your personal AI assistant