Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace out instances of RateLimiter.create(rate, Duration.ZERO) #1958

Merged
merged 2 commits into from
Nov 4, 2021

Conversation

carterkozak
Copy link
Contributor

==COMMIT_MSG==
Replace out instances of RateLimiter.create(rate, Duration.ZERO) which do not rate limit at all. See google/guava#2730
==COMMIT_MSG==

@changelog-app
Copy link

changelog-app bot commented Nov 4, 2021

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Replace out instances of RateLimiter.create(rate, Duration.ZERO) which do not rate limit at all. See google/guava#2730

Check the box to generate changelog(s)

  • Generate changelog entry

@policy-bot policy-bot bot requested a review from robert3005 November 4, 2021 20:29
@carterkozak carterkozak force-pushed the ckozak/revert_bad_ratelimiters branch from 1a84cc5 to 66f3df5 Compare November 4, 2021 20:29
@carterkozak carterkozak removed the request for review from robert3005 November 4, 2021 20:31
.addOutputLines(
"Test.java",
"import com.google.common.util.concurrent.RateLimiter;",
"import java.time.Duration;",
Copy link
Contributor

@kevin-yu-0602 kevin-yu-0602 Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No action required. Wondering if it is common/feasible to do import removal in cases like these. Or is there no way of guaranteeing the import isn't being used elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question: We could search the CompilationUnit for uses of any given import, but the fun part is that we don't have to :-) We always follow up automated refactors with our code formatter, that way the results become pretty, and unused imports are removed automatically!

.expectUnchanged()
.doTest();
}

Copy link
Contributor

@kevin-yu-0602 kevin-yu-0602 Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Could benefit from a sanity check that tests double arguments, i.e: RateLimiter.create(10, 100, TimeUnit.SECONDS);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figure we can add that when we fix the constant-zero case for the value-and-unit overload -- at the moment the check doesn't look at other overloads.

@carterkozak carterkozak merged commit 9a4b722 into develop Nov 4, 2021
@svc-autorelease
Copy link
Collaborator

Released 4.37.0

bulldozer-bot bot pushed a commit to palantir/witchcraft-api that referenced this pull request Nov 5, 2021
###### _excavator_ is a bot for automating changes across repositories.

Changes produced by the roomba/latest-baseline-oss check.

# Release Notes
## 4.37.0
| Type | Description | Link |
| ---- | ----------- | ---- |
| Fix | Replace out instances of `RateLimiter.create(rate, Duration.ZERO)` which do not rate limit at all. See google/guava#2730 | palantir/gradle-baseline#1958 |



To enable or disable this check, please contact the maintainers of Excavator.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants