http icon indicating copy to clipboard operation
http copied to clipboard

SoketException: Se agotó el tiempo de espera del semáforo (Semaphore timeout)

Open busslina opened this issue 2 years ago • 2 comments

I run the request code inside a try/catch block, but this exception seems to not be catched:

Future<bool> _serverAvailable() async {
  try {
    final response = await http
        .get(Uri.parse(availabilityUrl))
        .timeout(const Duration(seconds: 5), onTimeout: () {
      return http.Response('Internal 5 seconds timeout', 408);
    });

    return response.success;
  } catch (e) {
    return false;
  }
}

Captura

busslina avatar May 24 '23 06:05 busslina

Maybe it is not a good practice to use Future's timeout with Http client. I now using Dio client with timeout options

busslina avatar May 24 '23 21:05 busslina

Same problem here. Initialized today. ` Future<AllProducts> kidsClothes() async { final records = await pb .collection('products') .getList(filter: 'hay = true && category = "Infantil"');

AllProducts kidPijamas = AllProducts.fromJson(records.toJson());

notifyListeners();
return kidPijamas;

}` Captura de pantalla 2023-11-11 123340 image package pocketbase

nadveos avatar Nov 11 '23 15:11 nadveos