Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add logs to debug cio issue #1944

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion .infra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ if (isAdhocEnv) {
{
nameSuffix: 'bg',
args: ['dumb-init', 'node', 'bin/cli', 'background'],
env: [...jwtEnv],
minReplicas: 3,
maxReplicas: 10,
limits: bgLimits,
Expand All @@ -313,6 +314,7 @@ if (isAdhocEnv) {
},
ports: [{ containerPort: 9464, name: 'metrics' }],
servicePorts: [{ targetPort: 9464, port: 9464, name: 'metrics' }],
...jwtVols,
},
{
nameSuffix: 'private',
Expand Down Expand Up @@ -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: {
Expand Down
18 changes: 18 additions & 0 deletions src/workers/newNotificationV2Mail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ const formatTemplateDate = <T extends TemplateData>(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<void> => {
Expand All @@ -610,6 +612,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: {
Expand All @@ -618,6 +627,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;
}
Expand All @@ -632,6 +644,12 @@ const worker: Worker = {
attachments,
avatars,
);
if (debug) {
logger.info(
{ templateData, userId: user.id },
'got template data',
);
}
if (!templateData) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/workers/userUpdatedCio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
},
};

Expand Down
Loading