(key, factory)
| 778 | } |
| 779 | |
| 780 | runSingleFlight(key, factory) { |
| 781 | if (this.inFlight.has(key)) { |
| 782 | return this.inFlight.get(key); |
| 783 | } |
| 784 | |
| 785 | const promise = Promise.resolve() |
| 786 | .then(factory) |
| 787 | .finally(() => { |
| 788 | this.inFlight.delete(key); |
| 789 | }); |
| 790 | |
| 791 | this.inFlight.set(key, promise); |
| 792 | return promise; |
| 793 | } |
| 794 | |
| 795 | triggerBackgroundRefresh(key, factory) { |
| 796 | if (this.inFlight.has(key)) { |
no test coverage detected