Skip to content

Commit

Permalink
fix some minor mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
w-ensink committed Dec 12, 2024
1 parent da02f25 commit cbedd23
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class TokenManager {

public TokenManager() {
final String storageType = System.getenv("STORAGE_TYPE");
if (storageType == "redis") {
if (storageType.equals("redis")) {
LOG.info("using Redis token request repository");
tokenRepo = new RedisTokenRequestRepository();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
public class RateLimitUtils {
/// Returns the active rate limiter based on the configuration
public static RateLimit getRateLimiter() {
final String type = System.getenv("STORAGE_TYPE");
if (type == "redis") {
final String storageType = System.getenv("STORAGE_TYPE");
if (storageType.equals("redis")) {
return RedisRateLimit.getInstance();
}
return MemoryRateLimit.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class RedisRateLimit extends RateLimit {
final String ipLimitsNamespace = "ip-limits";
final String phoneLimitsNamespace = "phone-limits:";

public static RedisRateLimit getInstance() {
public static RateLimit getInstance() {
if (instance == null) {
instance = new RedisRateLimit();
}
Expand Down Expand Up @@ -164,6 +164,7 @@ protected synchronized void countPhone(String phone, long now) {
}
}

@Override
public void periodicCleanup() {
cleanUpIpLimits();
cleanUpPhoneLimits();
Expand Down

0 comments on commit cbedd23

Please sign in to comment.