Skip to content

Commit

Permalink
DOP-4599 logging
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellabuckvar committed Jun 6, 2024
1 parent 25b5e1e commit dbf9c6e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions api/controllers/v1/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export const DeployRepo = async (event: any = {}): Promise<any> => {
}
if (deployable.length > 0) {
try {
console.log('deploying repos');
await deployRepo(deployable, consoleLogger, jobRepository, c.get('jobsQueueUrl'));
} catch (e) {
return prepResponse(401, 'text/plain', `${e} error deploying repos`);
Expand Down
1 change: 1 addition & 0 deletions src/enhanced/utils/job/handle-job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export async function handleJob(jobId: string, db: mongodb.Db) {

try {
await jobManager.startSpecificJob(jobId);
console.log('in enhanced app handle job');
} catch (err) {
consoleLogger.info('enhancedApp', err);
}
Expand Down
1 change: 1 addition & 0 deletions src/onDemandApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ async function init(): Promise<void> {
);
try {
await jobManager.startSpecificJob(c.get('jobId'));
console.log('in onDemandApp');
} catch (err) {
consoleLogger.info('onDemandApp', err);
}
Expand Down
2 changes: 2 additions & 0 deletions src/repositories/baseRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export abstract class BaseRepository {

protected async insertMany(docs: Array<any>, errorMsg: string): Promise<any> {
try {
console.log('inserting many');
const insertManyResult = await this.promiseTimeoutS(
this._config.get('MONGO_TIMEOUT_S'),
this._collection.insertMany(docs),
Expand All @@ -36,6 +37,7 @@ export abstract class BaseRepository {
if (insertManyResult?.insertedIds) {
return insertManyResult.insertedIds;
}
console.log('returned null for insertMany??');
return null;
} catch (error) {
this._logger.error(`${this._repoName}:upsert`, `Failed to insert job (${JSON.stringify(docs)}) error: ${error}`);
Expand Down
2 changes: 1 addition & 1 deletion src/repositories/jobRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class JobRepository extends BaseRepository {
// Insertion/re-enqueueing should be sent to jobs queue and updates for an existing job should be sent to jobUpdates Queue
this._logger.info(
'insertBulkJobs',
`Total Jobs Expected : ${jobs.length}, Jobs: ${JSON.stringify(jobIds)}, Total Jobs Sent: ${jobIds.length}`
`Total Jobs Expected : ${jobs.length}, Jobs: ${JSON.stringify(jobIds)}, Total Jobs Sent: ${jobIds.keys().length}`
);
await Promise.all(
Object.values(jobIds).map(async (jobId: string) => {
Expand Down
2 changes: 1 addition & 1 deletion src/repositories/repoEntitlementsRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ export class RepoEntitlementsRepository extends BaseRepository {
throw new Error('getIsAdmin function must be given at least one argument');
}
let query;
console.log('getIsAdmin function called');
if (slackUserId) {
query = { slack_user_id: slackUserId };
} else query = { github_username: githubUsername };
const entitlementsObject = await this.findOne(
query,
`Mongo Timeout Error: Timedout while retrieving entitlements for ${slackUserId}`
);
console.log(`getIsAdmin function called, ${entitlementsObject?.admin}`);
return entitlementsObject?.admin;
}

Expand Down

0 comments on commit dbf9c6e

Please sign in to comment.