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
{{ message }}
Repository navigation
Add a WithKeyedResult option to the result pool #125
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.
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.
Activity
camdencheek commentedon Dec 27, 2023
Hi @zhongdai! Thanks for the request. I have a draft PR open to make the set of results from a
ResultPoolmatch the order of the tasks were submitted in. In combination withp.CollectErrored(), that would mean thatresult[i]always corresponds toqueries[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.