qfix: Fix github measurements (#9816)

1. Fix github measurements
2. A bit more proper fix for caching of Octokit references

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2025-09-10 00:00:08 +05:00
committed by GitHub
parent eb9150541b
commit 04a9c52d48
12 changed files with 238 additions and 124 deletions
@@ -122,11 +122,16 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS
const url = event.pull_request.issue_url
await syncRunner.exec(url, async () => {
await this.processEvent(ctx, event, derivedClient, repository, integration, project)
try {
await this.processEvent(ctx, event, derivedClient, repository, integration, project)
} catch (err: any) {
ctx.error('Error processing event', { error: err })
}
})
}
}
@withContext('pullrequests-processEvent')
private async processEvent (
ctx: MeasureContext,
event: PullRequestEvent,
@@ -139,8 +144,9 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS
let externalData: PullRequestExternalData
try {
const response: any = await integration.octokit?.graphql(
`query listIssue($name: String!, $owner: String!, $issue: Int!) {
const response: any = await ctx.with('graphql', {}, (ctx) =>
integration.octokit?.graphql(
`query listIssue($name: String!, $owner: String!, $issue: Int!) {
repository(name: $name, owner: $owner) {
pullRequest(number: $issue) {
${pullRequestDetails}
@@ -148,11 +154,12 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS
}
}
`,
{
name: repo.name,
owner: repo.owner?.login,
issue: event.pull_request.number
}
{
name: repo.name,
owner: repo.owner?.login,
issue: event.pull_request.number
}
)
)
externalData = response.repository.pullRequest
} catch (err: any) {
@@ -496,7 +503,7 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS
}
// To sync reviews/review threads in case they are created before us.
await syncChilds(info, this.client, derivedClient)
await syncChilds(ctx, info, this.client, derivedClient)
return {
needSync: '',