Return the latest context, sharing any in-flight provider refresh.
(url: string, ref: PRRef)
| 132 | |
| 133 | /** Return the latest context, sharing any in-flight provider refresh. */ |
| 134 | async getContext(url: string, ref: PRRef): Promise<PRContext> { |
| 135 | const entry = this.ensureEntry(url, ref); |
| 136 | if (!this.shouldRefresh(entry)) { |
| 137 | if (entry.inflight) return entry.inflight; |
| 138 | if (entry.context) return entry.context; |
| 139 | throw new Error(entry.error ?? "PR context is unavailable"); |
| 140 | } |
| 141 | |
| 142 | try { |
| 143 | return await this.refresh(url, ref, "poll"); |
| 144 | } catch (cause: unknown) { |
| 145 | if (entry.context) return entry.context; |
| 146 | throw cause; |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | /** Subscribe to live updates for a PR URL until the returned cleanup runs. */ |
| 151 | watch(url: string, ref: PRRef, subscriber: PRContextSubscriber): () => void { |
nothing calls this directly
no test coverage detected