algoliasearch-client-javascript: multipleBatch errors with a timeout
Hello friends,
I’m having timeout error (Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.
) when trying to execute a batch of operations. I don’t think the host is really unreachable (it works for other operations), but that something is wrong with my batch.
I made a repro repo here: https://github.com/pixelastic/algolia-batch-issue. Just run yarn run test
and it will try to batch the content of the input.json
and display the error when caught
My guess so far is that my batch is taking too long to execute on the server, so the client considers it a timeout error. I tried investigating through debug statements in algoliasearch
and @algolia/client-search
in my node_modules
, and it seems that the .wait()
on multipleBatch
is never called (ie. it errors before that).
My batch is only 3.2Mb, so I’m surprised that it takes that long to execute, though.
I tried splitting the batch in smaller chunks, and running them in parallel and I seemed to have a better luck that way, but not even reliably. I’m looking to understand the cause of the initial issue so I can tailor the number of chunks and parallel requests.
I also tried increasing the write timeout to 60s instead of the default 30, but I don’t think it had any effect. I could set the timeout smaller (like 2s) and see it fail earlier, but setting it higher didn’t seem like I could really make it go above 30s.
Any help would be appreciated
Note that because in this specific case I only have an array of addObject
I could use the addObjects
method directly and not bother with a batch, but I would still be very interested in understanding the limitations of the multipleBatch
method
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 18 (18 by maintainers)
Yay \o/ always here to find weird engine bugs!
Please, send my thanks to all the people involved in the fix
Oh I see, thanks. The trio JS + waitTask + old cluster is actually very much every project I do, though, so I’m eagerly waiting for any update on that. Thanks!
I see, thanks for the information. I’ll wait for the API to be fixed I guess, I don’t think I can reliably skip the
waitTask
part inalgolia-indexing