diff --git a/.infra/index.ts b/.infra/index.ts index acb454756..85252f566 100644 --- a/.infra/index.ts +++ b/.infra/index.ts @@ -302,6 +302,7 @@ if (isAdhocEnv) { { nameSuffix: 'bg', args: ['dumb-init', 'node', 'bin/cli', 'background'], + env: [...jwtEnv], minReplicas: 3, maxReplicas: 10, limits: bgLimits, @@ -313,6 +314,7 @@ if (isAdhocEnv) { }, ports: [{ containerPort: 9464, name: 'metrics' }], servicePorts: [{ targetPort: 9464, port: 9464, name: 'metrics' }], + ...jwtVols, }, { nameSuffix: 'private', @@ -559,7 +561,7 @@ if (!isAdhocEnv) { { isAdhocEnv: isAdhocEnv, namespace: namespace, - env: [{name: "JAVA_OPTS", value: "-Xmx3840m -Xms1024m"}], + env: [{ name: 'JAVA_OPTS', value: '-Xmx3840m -Xms1024m' }], props: { path: './clickhouse-sync.yml', keys: { diff --git a/src/workers/newNotificationV2Mail.ts b/src/workers/newNotificationV2Mail.ts index 1348f73ba..e6ad6b9e5 100644 --- a/src/workers/newNotificationV2Mail.ts +++ b/src/workers/newNotificationV2Mail.ts @@ -357,9 +357,8 @@ const notificationToTemplateData: Record = { if (!post || !post?.sharedPostId || !post?.authorId) { return; } - const [sharedPost, author, source] = await Promise.all([ + const [sharedPost, source] = await Promise.all([ con.getRepository(Post).findOneBy({ id: post.sharedPostId }), - post.author, post.source, ]); return { @@ -368,16 +367,12 @@ const notificationToTemplateData: Record = { squad_name: source.name, squad_image: source.image, post_title: truncatePostToTweet(sharedPost), - post_image: (sharedPost as ArticlePost).image || pickImageUrl(post), new_comment: notification.description, post_link: addNotificationEmailUtm( notification.targetUrl, notification.type, ), commenter_reputation: commenter.reputation, - user_name: author.name, - user_reputation: author.reputation, - user_image: author.image, commentary: truncatePostToTweet(post), }; }, @@ -594,6 +589,8 @@ const formatTemplateDate = (data: T): T => { const BATCH_SIZE = 1; const QUEUE_CONCURRENCY = 100; +const IDO_ID = '28849d86070e4c099c877ab6837c61f0'; + const worker: Worker = { subscription: 'api.new-notification-mail', handler: async (message, con, logger): Promise => { @@ -610,6 +607,13 @@ const worker: Worker = { await processStreamInBatches( stream, async (batch: { userId: string }[]) => { + const debug = !!batch.find((b) => b.userId === IDO_ID); + if (debug) { + logger.info( + { notification }, + 'starting to send notification email', + ); + } const users = await con.getRepository(User).find({ select: ['id', 'username', 'email'], where: { @@ -618,6 +622,9 @@ const worker: Worker = { notificationEmail: notification.public ? true : undefined, }, }); + if (debug) { + logger.info({ users: users.map((u) => u.username) }, 'found users'); + } if (!users.length) { return; } @@ -632,6 +639,12 @@ const worker: Worker = { attachments, avatars, ); + if (debug) { + logger.info( + { templateData, userId: user.id }, + 'got template data', + ); + } if (!templateData) { return; } diff --git a/src/workers/userUpdatedCio.ts b/src/workers/userUpdatedCio.ts index 501ab808d..f8d546b02 100644 --- a/src/workers/userUpdatedCio.ts +++ b/src/workers/userUpdatedCio.ts @@ -18,7 +18,7 @@ const worker: TypedWorker<'user-updated'> = { } await identifyUser(log, cio, user); - log.info({ userId: user.id }, 'updated user profile in customerio'); + log.debug({ userId: user.id }, 'updated user profile in customerio'); }, };