Need help. I am using `dart` client to populate `a...
# community-help
v
Need help. I am using
dart
client to populate
auto schema
collection. During
importJSONL
I am getting the below exception; import finishes but the number of documents is 4 times the number of lines in the
JSONL
file. Typesense is running in a
docker
container and the Dart client is on a remote machine. No issues with
Health
API Call or creating the collection. If i remove try..catch there are 0 documents created; with try…catch 4 times number of documents in
JSONL
Copy code
INFO: Importing JSONL documents.
SEVERE: TimeoutException after 0:00:02.000000: Future not completed
Copy code
/*documents.dart*/
Future<void> importJSONL(
  Client client, [
  // ignore: non_constant_identifier_names
  String? JSONL,
]) async {
  try {
    final file = File('documents.jsonl');
    logInfoln(log, 'Importing JSONL documents.');
    log.fine(await client
        .collection('test')
        .documents
        .importJSONL(JSONL ?? file.readAsStringSync()));
  //  await writePropagationDelay();
  } on RequestException catch (e, stackTrace) {
    log.severe(e.message, e, stackTrace);
  } catch (e, stackTrace) {
    log.severe(e, stackTrace);
  }
}
Copy code
/*main.dart*/
await collections.create2(client);
await documents.importJSONL(client);
I think its related to
connectionTimeout
property. will update :)
Copy code
final host = '<http://192.168.xxx.xxx|192.168.xxx.xxx>', protocol = Protocol.http;
  final config = Configuration(
    // Replace with your configur
    // ation
    'xxx',
    nodes: {
      Node(
        protocol,
        host,
        port: 8108,
      )
    },
    numRetries: 3, // A total of 4 tries (1 original try + 3 retries)
    connectionTimeout: const Duration(seconds: 2),
Worked after editing the
connetionTimeout
Property 🙂
👍 2