diff --git a/packages/import-handler/src/csv.ts b/packages/import-handler/src/csv.ts index 66835127c..80dd9c038 100644 --- a/packages/import-handler/src/csv.ts +++ b/packages/import-handler/src/csv.ts @@ -17,7 +17,6 @@ export const importCsv = async (ctx: ImportContext, stream: Stream) => { // labels follows format: "[label1, label2]" const labels = row.length > 2 ? row[2].slice(1, -1).split(',') : undefined await ctx.urlHandler(ctx, url, state, labels) - ctx.countImported += 1 } catch (error) { console.log('invalid url', row, error) ctx.countFailed += 1 diff --git a/packages/import-handler/src/index.ts b/packages/import-handler/src/index.ts index 557a57a4a..1b80314fb 100644 --- a/packages/import-handler/src/index.ts +++ b/packages/import-handler/src/index.ts @@ -1,17 +1,15 @@ import { Storage } from '@google-cloud/storage' -import { importCsv } from './csv' -import * as path from 'path' -import { importMatterArchive } from './matterHistory' -import { Stream } from 'node:stream' -import { v4 as uuid } from 'uuid' -import { CONTENT_FETCH_URL, createCloudTask, emailUserUrl } from './task' - -import axios from 'axios' -import { promisify } from 'util' -import * as jwt from 'jsonwebtoken' import { Readability } from '@omnivore/readability' - import * as Sentry from '@sentry/serverless' +import axios from 'axios' +import * as jwt from 'jsonwebtoken' +import { Stream } from 'node:stream' +import * as path from 'path' +import { promisify } from 'util' +import { v4 as uuid } from 'uuid' +import { importCsv } from './csv' +import { importMatterArchive } from './matterHistory' +import { CONTENT_FETCH_URL, createCloudTask, emailUserUrl } from './task' export enum ArticleSavingRequestStatus { Failed = 'FAILED', @@ -157,11 +155,10 @@ const urlHandler = async ( state, labels ) - if (result) { - ctx.countImported += 1 - } + result ? ctx.countImported++ : ctx.countFailed++ } catch (err) { console.log('error importing url', err) + ctx.countFailed += 1 } }