Resolving Import Error in Dart Client with Typesense
TLDR Vishal encountered an issue while populating auto schema
with dart
client, resulting in import exceptions. The problem was traced to the connectionTimeout
property and was resolved after adjusting its settings.
2
Mar 06, 2022 (20 months ago)
Vishal
07:05 AMdart
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
INFO: Importing JSONL documents.
SEVERE: TimeoutException after 0:00:02.000000: Future not completed```
/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);
}
}
/main.dart/await collections.create2(client);
await documents.importJSONL(client);```
Vishal
07:27 AMconnectionTimeout
property. will update :)final host = '', 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),
Vishal
07:31 AMconnetionTimeout
Property 🙂2
Typesense
Indexed 2779 threads (79% resolved)
Similar Threads
Resolve Connection Error on Records Upsert
Jainil faced consistent connection errors while upserting records. Jason identified an OOM issue, suggesting a capacity upgrade. Auto-scaling was discussed and the upgrade implementation process, which was in progress, was clarified.
Troubleshooting Indexing Duration in Typesense Import
Alan asked about lengthy indexing times for importing documents to Typesense. Jason suggested various potential causes, including network connectivity and system resources. They later identified the problem to be an error in Alan's code.
Resolving JSON Parsing Error in Import Function Implementation
Harpreet experienced a JSON parsing failure while implementing an import function. Kishore Nallan suggested double escaping characters in the JSON objects. After testing and discussion, both agreed that the error resulted from not handling JSON-encoded strings manually. Harpreet decided to update the test cases accordingly.