Hi,
I'm trying to add a timeout to a function call, so that once 5 seconds have passed, and if the function hasn't completed it should throw an exception. This is then wrapped in a retry:
await retry(
() => _sendUpdateTaskRequest(resultsJson).timeout(Duration(seconds: 5),
onTimeout: () => throw new Exception("ERRRR!")),
retryIf: (Exception e) =>
e is SocketException ||
e is TimeoutException ||
e is ClientException,
maxAttempts: requestRetryLimit,
);
But it seems to be that even if the function takes longer than 5 seconds, it never results in the exception being generated.
Thanks,
Yusuf