Skip to content

Commit

Permalink
Clean up logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dominiccooney committed Nov 12, 2024
1 parent bb12968 commit 3a6d347
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
6 changes: 2 additions & 4 deletions lib/shared/src/sourcegraph-api/graphql/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,16 @@ export class GraphQLResultCache<V> {
} else {
this.retryCount = 0
}
this.aborts = new AbortIgnorer()
}
} catch (error) {
if (this.lastFetch === thisFetch && error instanceof Error) {
this.lastResult = error
this.retryCount++
this.aborts = new AbortIgnorer()
}
// We swallow the error here; this Promise chain is just to
// update the cache's state.
} finally {
if (this.lastFetch === thisFetch) {
this.aborts = new AbortIgnorer()
}
}
})()
this.lastResult = undefined
Expand Down
14 changes: 0 additions & 14 deletions lib/shared/src/sourcegraph-api/graphql/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,6 @@ type GraphQLAPIClientConfig = PickResolvedConfiguration<{

const QUERY_TO_NAME_REGEXP = /^\s*(?:query|mutation)\s+(\w+)/m

let tattoo = 0

export class SourcegraphGraphQLAPIClient {
private dotcomUrl = DOTCOM_URL

Expand All @@ -662,23 +660,11 @@ export class SourcegraphGraphQLAPIClient {
return new SourcegraphGraphQLAPIClient(Observable.of(config))
}

private readonly id: number = tattoo++
private lastConfig = ''

private constructor(private readonly config: Observable<GraphQLAPIClientConfig>) {
this.versionCacheInvalidator = config.pipe(distinctUntilChanged()).subscribe({
next: () => {
const stringConfig = JSON.stringify(config)
console.log(
`DPC ${this.id} ${
stringConfig === this.lastConfig
} invalidating site version with new version ${stringConfig}`
)
this.lastConfig = stringConfig
this.siteVersionCache.invalidate()
},
error: error => console.error(`DPC ${this.id} error invalidating site version`, error),
complete: () => console.log(`DPC ${this.id} completed invalidating site version`),
})
}

Expand Down

0 comments on commit 3a6d347

Please sign in to comment.