Skip to content

Commit 02fcadf

Browse files
Merge pull request #776 from tarishij17/main
Fix special char usage in cmd line args for Rate Limiting the PRs
2 parents 890e120 + 28be9ba commit 02fcadf

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ named arguments:
141141
-s {true,false}, --skipprcreation {true,false}
142142
Only update image tag store. Skip creating PRs
143143
-x X comment snippet mentioned in line just before FROM instruction for ignoring a child image. Defaults to 'no-dfiu'
144-
-r, --rate-limit-pr-creations
144+
-r, --rate_limit_pr_creations
145145
Enable rateLimiting for throttling the number of PRs DFIU will cut over a period of time.
146-
The argument value should be in format "<positive_integer>-<ISO-8601_formatted_time>". For example "--rate-limit-pr-creations 60-PT1H" to create 60 PRs per hour.
146+
The argument value should be in format "<positive_integer>-<ISO-8601_formatted_time>". For example "--rate_limit_pr_creations 60-PT1H" to create 60 PRs per hour.
147147
Default is not set, this means no ratelimiting is imposed.
148148
149149
subcommands:
@@ -220,11 +220,11 @@ FROM imagename:imagetag # no-dfiu
220220
### PR throttling
221221

222222
In case you want to throttle the number of PRs cut by DFIU over a period of time,
223-
set --rate-limit-pr-creations with appropriate value.
223+
set --rate_limit_pr_creations with appropriate value.
224224

225225
##### Default case:
226226

227-
By default, this feature is disabled. This will be enabled when argument ``--rate-limit-pr-creations`` will be passed
227+
By default, this feature is disabled. This will be enabled when argument ``--rate_limit_pr_creations`` will be passed
228228
with appropriate value.
229229

230230
```
@@ -234,9 +234,9 @@ example: dockerfile-image-update all image-tag-store-repo-falcon //throttling wi
234234
##### Configuring the rate limit:
235235

236236
Below are some examples that will throttle the number of PRs cut based on values passed to the
237-
argument ``--rate-limit-pr-creations``
237+
argument ``--rate_limit_pr_creations``
238238
The argument value should be in format ``<positive_integer>-<ISO-8601_formatted_time>``.
239-
For example ``--rate-limit-pr-creations 60-PT1H`` would mean the tool will cut 60 PRs every hour and the rate of adding
239+
For example ``--rate_limit_pr_creations 60-PT1H`` would mean the tool will cut 60 PRs every hour and the rate of adding
240240
a new PR will be (PT1H/60) i.e. one minute.
241241
This will distribute the load uniformly and avoid sudden spikes, The process will go in waiting state until next PR
242242
could be sent.
@@ -245,11 +245,11 @@ Below are some more examples:
245245

246246
```
247247
Usage:
248-
dockerfile-image-update --rate-limit-pr-creations 60-PT1H all image-tag-store-repo-falcon //DFIU can send up to 60 PRs per hour.
249-
dockerfile-image-update --rate-limit-pr-creations 500-PT1H all image-tag-store-repo-falcon //DFIU can send up to 500 PRs per hour.
250-
dockerfile-image-update --rate-limit-pr-creations 86400-PT24H all image-tag-store-repo-falcon //DFIU can send up to 1 PRs per second.
251-
dockerfile-image-update --rate-limit-pr-creations 1-PT1S all image-tag-store-repo-falcon //Same as above. DFIU can send up to 1 PRs per second.
252-
dockerfile-image-update --rate-limit-pr-creations 5000 all image-tag-store-repo-falcon //rate limiting will be disabled because argument is not in correct format.
248+
dockerfile-image-update --rate_limit_pr_creations 60-PT1H all image-tag-store-repo-falcon //DFIU can send up to 60 PRs per hour.
249+
dockerfile-image-update --rate_limit_pr_creations 500-PT1H all image-tag-store-repo-falcon //DFIU can send up to 500 PRs per hour.
250+
dockerfile-image-update --rate_limit_pr_creations 86400-PT24H all image-tag-store-repo-falcon //DFIU can send up to 1 PRs per second.
251+
dockerfile-image-update --rate_limit_pr_creations 1-PT1S all image-tag-store-repo-falcon //Same as above. DFIU can send up to 1 PRs per second.
252+
dockerfile-image-update --rate_limit_pr_creations 5000 all image-tag-store-repo-falcon //rate limiting will be disabled because argument is not in correct format.
253253
```
254254

255255
## Developer Guide

dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/utils/Constants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ private Constants() {
4040
public static final String SKIP_PR_CREATION = "skipprcreation";
4141
public static final String IGNORE_IMAGE_STRING = "x";
4242
public static final String FILE_NAMES_TO_SEARCH = "filenamestosearch";
43-
public static final String RATE_LIMIT_PR_CREATION = "rate-limit-pr-creations";
43+
public static final String RATE_LIMIT_PR_CREATION = "rate_limit_pr_creations";
4444
//max number of PRs to be sent (or tokens to be added) per DEFAULT_RATE_LIMIT_DURATION(per hour in this case)
4545
public static final long DEFAULT_RATE_LIMIT = 60;
4646

4747
public static final long DEFAULT_CONSUMING_TOKEN_RATE = 1;
4848
public static final Duration DEFAULT_RATE_LIMIT_DURATION = Duration.ofMinutes(DEFAULT_RATE_LIMIT);
49-
//token adding rate(here:a token added every 2 minutes in the bucket)
49+
//token adding rate(here:a token added every 1 minutes in the bucket)
5050
public static final Duration DEFAULT_TOKEN_ADDING_RATE = Duration.ofMinutes(DEFAULT_CONSUMING_TOKEN_RATE);
5151
public static final String FILENAME_DOCKERFILE = "dockerfile";
5252
public static final String FILENAME_DOCKER_COMPOSE = "docker-compose";

0 commit comments

Comments
 (0)