Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mairatma committed Oct 10, 2023
1 parent 73084b9 commit d32449c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/HttpClient/middlewares/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { Span } from 'opentracing'
import { CacheLayer } from '../../caches/CacheLayer'
import { LOCALE_HEADER, SEGMENT_HEADER, SESSION_HEADER } from '../../constants'
import { IOContext } from '../../service/worker/runtime/typings'
import { ErrorReport } from '../../tracing'
import { HttpLogEvents } from '../../tracing/LogEvents'
import { HttpCacheLogFields } from '../../tracing/LogFields'
import { CustomHttpTags } from '../../tracing/Tags'
import { MiddlewareContext, RequestConfig } from '../typings'
import { ErrorReport } from '../../tracing'

const RANGE_HEADER_QS_KEY = '__range_header'
const cacheableStatusCodes = [200, 203, 204, 206, 300, 301, 404, 405, 410, 414, 501] // https://tools.ietf.org/html/rfc7231#section-6.1
Expand Down Expand Up @@ -108,7 +108,7 @@ export const cacheMiddleware = ({ type, storage }: CacheOptions) => {


const cacheReadSpan = createCacheSpan(cacheType, 'read', tracer, span)
let cached: void | Cached = undefined
let cached: void | Cached
try {
const cacheHasWithSegment = await storage.has(keyWithSegment)
cached = cacheHasWithSegment ? await storage.get(keyWithSegment) : await storage.get(key)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AxiosInstance } from 'axios'
import { HttpLogEvents } from '../../../../../tracing/LogEvents'
import { HttpRetryLogFields } from '../../../../../tracing/LogFields'
import { CustomHttpTags } from '../../../../../tracing/Tags'
import { isAbortedOrNetworkErrorOrRouterTimeout } from '../../../../../utils/retry'
import { RequestConfig } from '../../../../typings'
import { CustomHttpTags } from '../../../../../tracing/Tags'

function fixConfig(axiosInstance: AxiosInstance, config: RequestConfig) {
if (axiosInstance.defaults.httpAgent === config.httpAgent) {
Expand Down Expand Up @@ -68,7 +68,7 @@ const onResponseError = (http: AxiosInstance) => (error: any) => {
config.tracing?.rootSpan?.log({ event: HttpLogEvents.SETUP_REQUEST_RETRY, [HttpRetryLogFields.RETRY_NUMBER]: config.retryCount, [HttpRetryLogFields.RETRY_IN]: delay })
config.tracing?.rootSpan?.addTags({
[CustomHttpTags.HTTP_RETRY_COUNT]: config.retryCount,
[CustomHttpTags.HTTP_RETRY_ERROR_CODE]: error.code
[CustomHttpTags.HTTP_RETRY_ERROR_CODE]: error.code,
})

return new Promise(resolve => setTimeout(() => resolve(http(config)), delay))
Expand Down
2 changes: 1 addition & 1 deletion src/tracing/Tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const enum CustomHttpTags {
HTTP_ROUTER_CACHE_RESULT = 'http.cache.router',

HTTP_RETRY_ERROR_CODE = 'http.retry.error.code',
HTTP_RETRY_COUNT = 'http.retry.count'
HTTP_RETRY_COUNT = 'http.retry.count',
}

export const UserlandTags = {
Expand Down

0 comments on commit d32449c

Please sign in to comment.