fix: preserve input order in WorkerPool.map() by replacing as_complet…#2
Conversation
|
One small suggestion before merge: could you also add a timing-based regression test similar to the reproduction scenario from the issue? That would help permanently validate ordering preservation under varying task completion times. Other than that, the change looks good. |
|
Hi, I have added the timing-based regression test as suggested. |
|
Squash these into a single commit with a clean Conventional Commits message, then force-push to the same branch. |
…ed() with pool.map()
bc7f8c5 to
1ca206e
Compare
|
Hi, I have squashed the commits into a single clean commit |
|
LGTM, thank you! Merging. |
|
Thank you for your contribution. The submitted fix has been reviewed and merged successfully. You have successfully completed this evaluation task and have been shortlisted for the next round of the selection process. Please send the following details to hr@digiscrypt.com for verification purposes:
|
Fixes #1
Problem
as_completed()returns futures in completion order, not submission order.This caused
WorkerPool.map()to return results misaligned with input items.Fix
Replaced
as_completed()loop withThreadPoolExecutor.map()which preservesinput order by design.
Test
Updated
test_worker_pool_maps_itemsto assert strict ordering (removed thesorted()workaround that was masking the bug).