Skip to content

Commit

Permalink
update after review
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPonchia committed Dec 20, 2024
1 parent f8b597f commit 2f1c8a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
5 changes: 0 additions & 5 deletions .changeset/heavy-points-clean.md

This file was deleted.

1 change: 1 addition & 0 deletions packages/active-campaign-client/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ AC_RESYNC_TIMEOUT_IN_MS=1000
# Only needed run import script locally
AWS_ACCESS_KEY_ID=AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY=AWS_SECRET_ACCESS_KEY
USERS_TO_IMPORT_LIMIT=5 #optional only for local testing

TEST_AC_BASE_URL=your_account_url
TEST_AC_API_KEY=your_api_key
Expand Down
9 changes: 5 additions & 4 deletions packages/active-campaign-client/src/scripts/sync_all_users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ async function main() {
return true;
});

// limit uniqueUsersAndWebinars to 10
const limitedUniqueUsersAndWebinars = uniqueUsersAndWebinars
const usersToImportLimit = !!process.env.USERS_TO_IMPORT_LIMIT && parseInt(process.env.USERS_TO_IMPORT_LIMIT);
const limitedUniqueUsersAndWebinars = usersToImportLimit ? uniqueUsersAndWebinars
.filter((userAndWebinars) => userAndWebinars.subscribedWebinars.length > 0)
.slice(0, 2);
.slice(0, usersToImportLimit)
: uniqueUsersAndWebinars;

const acPayload = limitedUniqueUsersAndWebinars.map((userAndWebinars, index) => ({
contact: {
Expand Down Expand Up @@ -146,4 +147,4 @@ async function main() {
main().catch(error => {
console.error('Error executing script:', error);
process.exit(1);
});
});

0 comments on commit 2f1c8a5

Please sign in to comment.