You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this example, the record is a struct to map to a database record, and each databaseCall() would return N records as a []record type.
If any of the query failed to run (eg. timeout), the result (typed [][]record) contains only the succeed returned []record. So the len(queries) != len(result).
In the case, I need to re-try the failed queries, I don't know which ones are failed. So if we can have a option to return a map[string][]record, we can check if which batch(es) are failing.
The text was updated successfully, but these errors were encountered:
Hi @zhongdai! Thanks for the request. I have a draft PR open to make the set of results from a ResultPool match the order of the tasks were submitted in. In combination with p.CollectErrored(), that would mean that result[i] always corresponds to queries[i]. Does that solve your use case?
Side note: now that result order is deterministic, I'm considering making CollectErrored() default for the 1.0 release. However, that's a breaking change, so I didn't implement that in the original PR.
I have been using the result pool to fan-out some I/O operations, eg. fetch data from database. The code is something like,
In this example, the
record
is a struct to map to a database record, and eachdatabaseCall()
would return N records as a[]record
type.If any of the query failed to run (eg. timeout), the
result
(typed[][]record
) contains only the succeed returned[]record
. So thelen(queries) != len(result)
.In the case, I need to re-try the failed queries, I don't know which ones are failed. So if we can have a option to return a
map[string][]record
, we can check if which batch(es) are failing.The text was updated successfully, but these errors were encountered: