mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
profile query time
This commit is contained in:
parent
913215ab09
commit
eaf5632d0a
2 changed files with 14 additions and 2 deletions
|
|
@ -670,7 +670,7 @@ export const searchResolver = authorized<
|
|||
SearchSuccess,
|
||||
SearchError,
|
||||
QuerySearchArgs
|
||||
>(async (_obj, params, { uid }) => {
|
||||
>(async (_obj, params, { uid, log }) => {
|
||||
const startCursor = params.after || ''
|
||||
const first = Math.min(params.first || 10, 100) // limit to 100 items
|
||||
|
||||
|
|
@ -679,6 +679,7 @@ export const searchResolver = authorized<
|
|||
return { errorCodes: [SearchErrorCode.QueryTooLong] }
|
||||
}
|
||||
|
||||
log.profile('searchResolver')
|
||||
const { libraryItems, count } = await searchAndCountLibraryItems(
|
||||
{
|
||||
from: Number(startCursor),
|
||||
|
|
@ -691,6 +692,7 @@ export const searchResolver = authorized<
|
|||
},
|
||||
uid
|
||||
)
|
||||
log.profile('searchResolver')
|
||||
|
||||
const start =
|
||||
startCursor && !isNaN(Number(startCursor)) ? Number(startCursor) : 0
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import {
|
|||
wordsCount,
|
||||
} from '../utils/helpers'
|
||||
import { createImageProxyUrl } from '../utils/imageproxy'
|
||||
import { logger } from '../utils/logger'
|
||||
import { contentConverter } from '../utils/parser'
|
||||
import {
|
||||
generateDownloadSignedUrl,
|
||||
|
|
@ -482,7 +483,9 @@ export const functionResolvers = {
|
|||
ctx.claims &&
|
||||
item.uploadFileId
|
||||
) {
|
||||
logger.profile('uploadFiles' + item.id)
|
||||
const upload = await ctx.dataLoaders.uploadFiles.load(item.uploadFileId)
|
||||
logger.profile('uploadFiles' + item.id)
|
||||
if (!upload || !upload.fileName) {
|
||||
return undefined
|
||||
}
|
||||
|
|
@ -515,7 +518,10 @@ export const functionResolvers = {
|
|||
) {
|
||||
if (item.labels) return item.labels
|
||||
|
||||
return ctx.dataLoaders.labels.load(item.id)
|
||||
logger.profile('labels' + item.id)
|
||||
const labels = await ctx.dataLoaders.labels.load(item.id)
|
||||
logger.profile('labels' + item.id)
|
||||
return labels
|
||||
},
|
||||
async recommendations(
|
||||
item: {
|
||||
|
|
@ -527,9 +533,11 @@ export const functionResolvers = {
|
|||
) {
|
||||
if (item.recommendations) return item.recommendations
|
||||
|
||||
logger.profile('recommendations' + item.id)
|
||||
const recommendations = await ctx.dataLoaders.recommendations.load(
|
||||
item.id
|
||||
)
|
||||
logger.profile('recommendations' + item.id)
|
||||
return recommendations.map(recommandationDataToRecommendation)
|
||||
},
|
||||
async aiSummary(item: SearchItem, _: unknown, ctx: WithDataSourcesContext) {
|
||||
|
|
@ -551,7 +559,9 @@ export const functionResolvers = {
|
|||
) {
|
||||
if (item.highlights) return item.highlights
|
||||
|
||||
logger.profile('highlights' + item.id)
|
||||
const highlights = await ctx.dataLoaders.highlights.load(item.id)
|
||||
logger.profile('highlights' + item.id)
|
||||
return highlights.map(highlightDataToHighlight)
|
||||
},
|
||||
...readingProgressHandlers,
|
||||
|
|
|
|||
Loading…
Reference in a new issue