Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

chore(backfill): add logging for backfill script #1007

Merged
merged 1 commit into from
Dec 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions server/src/modules/search/backfill/backfill.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export class BackfillController {
* @returns result async with error or response
*/
indexAllData = async (indexName: string) => {
logger.info({
message: `Querying data from database`,
meta: { function: `indexAllData` },
})
return await ResultAsync.fromPromise(
this.postService.listPosts({
sort: SortType.Top,
Expand All @@ -61,6 +65,10 @@ export class BackfillController {
)
.map(async (postResponse) => {
const searchEntriesDataset: SearchEntry[] = []
logger.info({
message: `Creating searchEntriesDataset for ${postResponse.posts.length} posts`,
meta: { function: `indexAllData` },
})
for (const post of postResponse.posts) {
const listAnswersResult = await ResultAsync.fromPromise(
this.answersService.listAnswers(post.id),
Expand Down Expand Up @@ -98,6 +106,10 @@ export class BackfillController {
return listAnswersResult
}
}
logger.info({
message: `Indexing searchEntriesDataset on search service`,
meta: { function: `indexAllData` },
})
return await this.searchService.indexAllData(
indexName,
searchEntriesDataset,
Expand Down