timeout() does not seem to be timing out

25 views
Skip to first unread message

Yusuf Mohsinally

unread,
Aug 2, 2021, 3:27:06 AM8/2/21
to Dart Misc
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

Chris Norman

unread,
Aug 2, 2021, 5:21:16 AM8/2/21
to mi...@dartlang.org
Is something blocking in those calls?

Take care,

Chris Norman



--
For more ways to connect visit https://dart.dev/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/1950a64b-883a-4819-bf08-229422ab4caen%40dartlang.org.
Reply all
Reply to author
Forward
0 new messages