Timeout not handled in Search.fetch_all_records
phlare opened this issue · comments
I'm intermittently seeing this unhandled error in my integration with this library:
(braintree 0.10.0) lib/search.ex:41: Braintree.Search.fetch_all_records/4
** (Protocol.UndefinedError) protocol Enumerable not implemented for {:error, :timeout} of type Tuple. This protocol is implemented for the following type(s): Ecto.Adapters.SQL.Stream, Postgrex.Stream, DBConnection.Stream, DBConnection.PrepareStream, Timex.Interval, Stream, Function, File.Stream, Date.Range, HashDict, HashSet, GenEvent.Stream, MapSet, IO.Stream, Range, List, Map
I'm calling Customer.search/1
with params data that looks like:
customer_ids = [1,2,3,4,5,6,7] #Enum of real ids here obviously
search_params = %{ids: customer_ids}
case Customer.search(search_params) do
#cases to handle return values
end
For the time being, i've reduced the occurrence of this timeout to almost none, by passing smaller batches of customer_ids to this function, but it would be nice for this to be handled properly and for Customer.search/1
to return {:error, :timeout}
or something similar.
note- i've also upgraded to 0.11.0 in case this was a known issue and resolved in that release, but I don't see anything that would have changed there in the commits between 0.10.0 and 0.11.0