Commit 58fb699
authored
[Collections] testPopulateTargetTrie sometimes gets stuck (#3522)
Motivation:
`PackageCollectionsStorageTests/testPopulateTargetTrie` gets stuck sometimes because `targetTrieReady` is already set and `callback` is only invoked in the body of `memoize`.
https://ci.swift.org/job/oss-swift-package-ubuntu-20_04-aarch64/79/console
Modifications:
Rearrange logic in `populateTargetTrie` such that `callback` is invoked outside of `memoize` body.
Also, add `populateTargetTrieLock` to prevent more than one thread from calling `memoize` at the same time.1 parent 50c958b commit 58fb699
File tree
2 files changed
+19
-16
lines changed- Sources/PackageCollections/Storage
- Tests/PackageCollectionsTests
2 files changed
+19
-16
lines changedLines changed: 16 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
503 | 504 | | |
504 | 505 | | |
505 | 506 | | |
506 | | - | |
| 507 | + | |
507 | 508 | | |
508 | 509 | | |
509 | 510 | | |
| |||
761 | 762 | | |
762 | 763 | | |
763 | 764 | | |
764 | | - | |
765 | | - | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
766 | 772 | | |
767 | 773 | | |
768 | 774 | | |
769 | | - | |
770 | | - | |
| 775 | + | |
| 776 | + | |
771 | 777 | | |
772 | 778 | | |
773 | 779 | | |
| |||
796 | 802 | | |
797 | 803 | | |
798 | 804 | | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
| 805 | + | |
804 | 806 | | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
805 | 810 | | |
806 | 811 | | |
807 | 812 | | |
| |||
Lines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
| 234 | + | |
| 235 | + | |
238 | 236 | | |
239 | 237 | | |
240 | 238 | | |
| |||
0 commit comments