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

INT-9845: add additional logs #222

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 6 additions & 4 deletions src/gsuite/clients/GSuiteInstalledAppsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,21 @@ export class GSuiteInstalledAppsClient extends GSuiteChromeManagementClient {
): Promise<void> {
const client = await this.getAuthenticatedServiceClient();

const threeMonths = new Date();
threeMonths.setMonth(threeMonths.getMonth() - 3);
const threeMonthsFormatted = threeMonths.toISOString().split('T')[0]; // Format date to YYYY-MM-DD
const oneMonth = new Date();
oneMonth.setMonth(oneMonth.getMonth() - 1);
const oneMonthFormatted = oneMonth.toISOString().split('T')[0]; // Format date to YYYY-MM-DD

await this.iterateApi(
async () => {
return client.customers.reports.countInstalledApps({
customer: `customers/${this.accountId}`,
filter: `app_type=${appType} AND latest_profile_active_date>=${threeMonthsFormatted}`,
filter: `app_type=${appType} AND latest_profile_active_date>=${oneMonthFormatted} AND total_install_count>0`,
pageSize: 1000,
});
},
async (data) => {
// TEMP 9845:
this.logger.info(`Installed apps length ${data.installedApps?.length}`);
await pMap(
data.installedApps || [],
async (app) => {
Expand Down
4 changes: 2 additions & 2 deletions src/steps/chrome-extensions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { isAuthorizationError } from '../../utils/isAuthorizationError';
const APP_EXTENSION_TYPE = 'EXTENSION';

function isMultipleOfHundredThousand(num: number) {
return num % 100000 === 0;
return num % 1000 === 0;
}

export async function fetchChromeExtensions({
Expand All @@ -42,7 +42,7 @@ export async function fetchChromeExtensions({
}
await jobState.addEntity(createChromeExtensionEntity(app));

processedCount++;
processedCount = processedCount + 1;

if (isMultipleOfHundredThousand(processedCount)) {
logger.info(`Processing extensions: ${processedCount}`);
Expand Down
Loading