Skip to content

Commit 75b8252

Browse files
committed
remove the crap ton of emojis in logging, attempt to fix rate limiting
1 parent 5cca799 commit 75b8252

File tree

2 files changed

+52
-52
lines changed

2 files changed

+52
-52
lines changed

dist/index.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
const core = __nccwpck_require__(7484);
88

99
// Rate limiting and retry constants
10-
const RATE_LIMIT_DELAY = 500; // milliseconds between requests (increased from 100ms)
10+
const RATE_LIMIT_DELAY = 1500; // milliseconds between requests (increased to 1.5s)
1111
const MAX_RETRIES = 3;
12-
const RETRY_DELAY = 2000; // 2 second base delay for retries (increased from 1s)
13-
const BATCH_SIZE = 5; // Process 5 flags at a time (reduced from 10)
14-
const BATCH_DELAY = 2000; // 2 second delay between batches (increased from 500ms)
12+
const RETRY_DELAY = 2000; // 2 second base delay for retries
13+
const BATCH_SIZE = 5; // Process 5 flags at a time (not used in sequential processing)
14+
const BATCH_DELAY = 2000; // 2 second delay between batches (not used in sequential processing)
1515

1616
/**
1717
* Sleep utility function
@@ -120,12 +120,12 @@ async function run() {
120120
throw new Error(`Invalid days_from_creation value: ${daysFromCreationInput}. Must be a number between 1 and 365`);
121121
}
122122

123-
core.info(`🚀 Starting LaunchDarkly Flag Expiry Setter`);
124-
core.info(`📋 Project: ${projectKey}`);
125-
core.info(`📅 Days from creation: ${daysFromCreation}`);
126-
core.info(`🏷️ Custom property: ${customPropertyName}`);
127-
core.info(`📊 Date format: ${dateFormat}`);
128-
core.info(`⏭️ Skip existing: ${skipExisting}`);
123+
core.info(`Starting LaunchDarkly Flag Expiry Setter`);
124+
core.info(`Project: ${projectKey}`);
125+
core.info(`Days from creation: ${daysFromCreation}`);
126+
core.info(`Custom property: ${customPropertyName}`);
127+
core.info(`Date format: ${dateFormat}`);
128+
core.info(`Skip existing: ${skipExisting}`);
129129

130130
// 1. Fetch all flags with proper pagination/throttling
131131
const allFlags = await getAllFeatureFlags(apiKey, projectKey);
@@ -152,16 +152,16 @@ async function run() {
152152
}
153153

154154
// 4. Output comprehensive results
155-
core.info(`\n📊 Final Summary:`);
156-
core.info(`🔍 Total flags found: ${allFlags.length}`);
157-
core.info(`⏭️ Flags skipped: ${flagsSkipped.length}`);
158-
core.info(`Successfully updated: ${results.updatedFlags.length}`);
159-
core.info(`Failed to update: ${results.failedFlags.length}`);
160-
core.info(`📋 Total processed: ${results.totalProcessed}`);
155+
core.info(`\nFinal Summary:`);
156+
core.info(`Total flags found: ${allFlags.length}`);
157+
core.info(`Flags skipped: ${flagsSkipped.length}`);
158+
core.info(`Successfully updated: ${results.updatedFlags.length}`);
159+
core.info(`Failed to update: ${results.failedFlags.length}`);
160+
core.info(`Total processed: ${results.totalProcessed}`);
161161

162162
// Log skipped flags summary
163163
if (flagsSkipped.length > 0) {
164-
core.info(`\n⏭️ Skipped flags breakdown:`);
164+
core.info(`\nSkipped flags breakdown:`);
165165
const skipReasons = {};
166166
flagsSkipped.forEach(flag => {
167167
const reason = flag.reason.includes('Already has') ? 'Already has expiry' : flag.reason;
@@ -255,7 +255,7 @@ async function getAllFeatureFlags(apiKey, projectKey) {
255255
const limit = 50; // LaunchDarkly API default
256256
let totalCount = null;
257257

258-
core.info('🔍 Fetching all feature flags from LaunchDarkly...');
258+
core.info('Fetching all feature flags from LaunchDarkly...');
259259

260260
// eslint-disable-next-line no-constant-condition
261261
while (true) {
@@ -275,7 +275,7 @@ async function getAllFeatureFlags(apiKey, projectKey) {
275275
// Track progress for large datasets
276276
if (totalCount === null && data.totalCount) {
277277
totalCount = data.totalCount;
278-
core.info(`📊 Found ${totalCount} total flags to process`);
278+
core.info(`Found ${totalCount} total flags to process`);
279279
}
280280

281281
if (data.items && data.items.length > 0) {
@@ -284,7 +284,7 @@ async function getAllFeatureFlags(apiKey, projectKey) {
284284

285285
// Progress logging
286286
const progress = totalCount ? `${flags.length}/${totalCount}` : flags.length;
287-
core.info(`📋 Retrieved ${progress} flags`);
287+
core.info(`Retrieved ${progress} flags`);
288288

289289
// If we got fewer items than the limit, we've reached the end
290290
if (data.items.length < limit) {
@@ -300,7 +300,7 @@ async function getAllFeatureFlags(apiKey, projectKey) {
300300
}
301301
}
302302

303-
core.info(`Successfully retrieved ${flags.length} total flags`);
303+
core.info(`Successfully retrieved ${flags.length} total flags`);
304304
return flags;
305305
}
306306

@@ -441,7 +441,7 @@ function filterFlagsNeedingExpiry(flags, customPropertyName, skipExisting) {
441441
const flagsToProcess = [];
442442
const flagsSkipped = [];
443443

444-
core.info(`🔍 Filtering flags that need expiry dates...`);
444+
core.info(`Filtering flags that need expiry dates...`);
445445

446446
for (const flag of flags) {
447447
// Check if flag already has the custom property
@@ -474,7 +474,7 @@ function filterFlagsNeedingExpiry(flags, customPropertyName, skipExisting) {
474474
flagsToProcess.push(flag);
475475
}
476476

477-
core.info(`📊 Filtering complete: ${flagsToProcess.length} to process, ${flagsSkipped.length} skipped`);
477+
core.info(`Filtering complete: ${flagsToProcess.length} to process, ${flagsSkipped.length} skipped`);
478478
return { flagsToProcess, flagsSkipped };
479479
}
480480

@@ -531,17 +531,17 @@ async function processFlagsInBatches(flagsToProcess, apiKey, projectKey, customP
531531
};
532532

533533
if (flagsToProcess.length === 0) {
534-
core.info('📋 No flags to process');
534+
core.info('No flags to process');
535535
return results;
536536
}
537537

538-
core.info(`🚀 Processing ${flagsToProcess.length} flags sequentially`);
538+
core.info(`Processing ${flagsToProcess.length} flags sequentially`);
539539

540540
for (let i = 0; i < flagsToProcess.length; i++) {
541541
const flag = flagsToProcess[i];
542542
results.totalProcessed++;
543543

544-
core.info(`📦 Processing flag ${i + 1}/${flagsToProcess.length}: ${flag.key}`);
544+
core.info(`Processing flag ${i + 1}/${flagsToProcess.length}: ${flag.key}`);
545545

546546
try {
547547
const result = await processSingleFlag(flag, apiKey, projectKey, customPropertyName, daysFromCreation, dateFormat);

index.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const core = require('@actions/core');
22

33
// Rate limiting and retry constants
4-
const RATE_LIMIT_DELAY = 500; // milliseconds between requests (increased from 100ms)
4+
const RATE_LIMIT_DELAY = 1500; // milliseconds between requests (increased to 1.5s)
55
const MAX_RETRIES = 3;
6-
const RETRY_DELAY = 2000; // 2 second base delay for retries (increased from 1s)
7-
const BATCH_SIZE = 5; // Process 5 flags at a time (reduced from 10)
8-
const BATCH_DELAY = 2000; // 2 second delay between batches (increased from 500ms)
6+
const RETRY_DELAY = 2000; // 2 second base delay for retries
7+
const BATCH_SIZE = 5; // Process 5 flags at a time (not used in sequential processing)
8+
const BATCH_DELAY = 2000; // 2 second delay between batches (not used in sequential processing)
99

1010
/**
1111
* Sleep utility function
@@ -114,12 +114,12 @@ async function run() {
114114
throw new Error(`Invalid days_from_creation value: ${daysFromCreationInput}. Must be a number between 1 and 365`);
115115
}
116116

117-
core.info(`🚀 Starting LaunchDarkly Flag Expiry Setter`);
118-
core.info(`📋 Project: ${projectKey}`);
119-
core.info(`📅 Days from creation: ${daysFromCreation}`);
120-
core.info(`🏷️ Custom property: ${customPropertyName}`);
121-
core.info(`📊 Date format: ${dateFormat}`);
122-
core.info(`⏭️ Skip existing: ${skipExisting}`);
117+
core.info(`Starting LaunchDarkly Flag Expiry Setter`);
118+
core.info(`Project: ${projectKey}`);
119+
core.info(`Days from creation: ${daysFromCreation}`);
120+
core.info(`Custom property: ${customPropertyName}`);
121+
core.info(`Date format: ${dateFormat}`);
122+
core.info(`Skip existing: ${skipExisting}`);
123123

124124
// 1. Fetch all flags with proper pagination/throttling
125125
const allFlags = await getAllFeatureFlags(apiKey, projectKey);
@@ -146,16 +146,16 @@ async function run() {
146146
}
147147

148148
// 4. Output comprehensive results
149-
core.info(`\n📊 Final Summary:`);
150-
core.info(`🔍 Total flags found: ${allFlags.length}`);
151-
core.info(`⏭️ Flags skipped: ${flagsSkipped.length}`);
152-
core.info(`Successfully updated: ${results.updatedFlags.length}`);
153-
core.info(`Failed to update: ${results.failedFlags.length}`);
154-
core.info(`📋 Total processed: ${results.totalProcessed}`);
149+
core.info(`\nFinal Summary:`);
150+
core.info(`Total flags found: ${allFlags.length}`);
151+
core.info(`Flags skipped: ${flagsSkipped.length}`);
152+
core.info(`Successfully updated: ${results.updatedFlags.length}`);
153+
core.info(`Failed to update: ${results.failedFlags.length}`);
154+
core.info(`Total processed: ${results.totalProcessed}`);
155155

156156
// Log skipped flags summary
157157
if (flagsSkipped.length > 0) {
158-
core.info(`\n⏭️ Skipped flags breakdown:`);
158+
core.info(`\nSkipped flags breakdown:`);
159159
const skipReasons = {};
160160
flagsSkipped.forEach(flag => {
161161
const reason = flag.reason.includes('Already has') ? 'Already has expiry' : flag.reason;
@@ -249,7 +249,7 @@ async function getAllFeatureFlags(apiKey, projectKey) {
249249
const limit = 50; // LaunchDarkly API default
250250
let totalCount = null;
251251

252-
core.info('🔍 Fetching all feature flags from LaunchDarkly...');
252+
core.info('Fetching all feature flags from LaunchDarkly...');
253253

254254
// eslint-disable-next-line no-constant-condition
255255
while (true) {
@@ -269,7 +269,7 @@ async function getAllFeatureFlags(apiKey, projectKey) {
269269
// Track progress for large datasets
270270
if (totalCount === null && data.totalCount) {
271271
totalCount = data.totalCount;
272-
core.info(`📊 Found ${totalCount} total flags to process`);
272+
core.info(`Found ${totalCount} total flags to process`);
273273
}
274274

275275
if (data.items && data.items.length > 0) {
@@ -278,7 +278,7 @@ async function getAllFeatureFlags(apiKey, projectKey) {
278278

279279
// Progress logging
280280
const progress = totalCount ? `${flags.length}/${totalCount}` : flags.length;
281-
core.info(`📋 Retrieved ${progress} flags`);
281+
core.info(`Retrieved ${progress} flags`);
282282

283283
// If we got fewer items than the limit, we've reached the end
284284
if (data.items.length < limit) {
@@ -294,7 +294,7 @@ async function getAllFeatureFlags(apiKey, projectKey) {
294294
}
295295
}
296296

297-
core.info(`Successfully retrieved ${flags.length} total flags`);
297+
core.info(`Successfully retrieved ${flags.length} total flags`);
298298
return flags;
299299
}
300300

@@ -435,7 +435,7 @@ function filterFlagsNeedingExpiry(flags, customPropertyName, skipExisting) {
435435
const flagsToProcess = [];
436436
const flagsSkipped = [];
437437

438-
core.info(`🔍 Filtering flags that need expiry dates...`);
438+
core.info(`Filtering flags that need expiry dates...`);
439439

440440
for (const flag of flags) {
441441
// Check if flag already has the custom property
@@ -468,7 +468,7 @@ function filterFlagsNeedingExpiry(flags, customPropertyName, skipExisting) {
468468
flagsToProcess.push(flag);
469469
}
470470

471-
core.info(`📊 Filtering complete: ${flagsToProcess.length} to process, ${flagsSkipped.length} skipped`);
471+
core.info(`Filtering complete: ${flagsToProcess.length} to process, ${flagsSkipped.length} skipped`);
472472
return { flagsToProcess, flagsSkipped };
473473
}
474474

@@ -525,17 +525,17 @@ async function processFlagsInBatches(flagsToProcess, apiKey, projectKey, customP
525525
};
526526

527527
if (flagsToProcess.length === 0) {
528-
core.info('📋 No flags to process');
528+
core.info('No flags to process');
529529
return results;
530530
}
531531

532-
core.info(`🚀 Processing ${flagsToProcess.length} flags sequentially`);
532+
core.info(`Processing ${flagsToProcess.length} flags sequentially`);
533533

534534
for (let i = 0; i < flagsToProcess.length; i++) {
535535
const flag = flagsToProcess[i];
536536
results.totalProcessed++;
537537

538-
core.info(`📦 Processing flag ${i + 1}/${flagsToProcess.length}: ${flag.key}`);
538+
core.info(`Processing flag ${i + 1}/${flagsToProcess.length}: ${flag.key}`);
539539

540540
try {
541541
const result = await processSingleFlag(flag, apiKey, projectKey, customPropertyName, daysFromCreation, dateFormat);

0 commit comments

Comments
 (0)