in get_bold_record_count, the call file_get_contents(bold url) can timeout, causing an HTTP failure and an ungraceful crash. This generally only happens if asking BOLD to count entries in a super huge phylum (e.g. Arthropoda)
Fix the timeout by adding longer timeout in the context to the request:
$context = stream_context_create([
'http' => ['timeout' => 300] // 5 minutes for BOLD to respond - should be long enough to count biggest phyla
]);
$bold_response = json_decode(file_get_contents($bold_query, false, $context), true);
And additionally respond better to other HTTP failures (although this isn't strictly necessary as the SSE communication to client is closed properly even on crash).
in get_bold_record_count, the call file_get_contents(bold url) can timeout, causing an HTTP failure and an ungraceful crash. This generally only happens if asking BOLD to count entries in a super huge phylum (e.g. Arthropoda)
Fix the timeout by adding longer timeout in the context to the request:
And additionally respond better to other HTTP failures (although this isn't strictly necessary as the SSE communication to client is closed properly even on crash).