diff --git a/src/main/java/foundation/privacybydesign/sms/TokenManager.java b/src/main/java/foundation/privacybydesign/sms/TokenManager.java index d99f5c3..ae6d17d 100644 --- a/src/main/java/foundation/privacybydesign/sms/TokenManager.java +++ b/src/main/java/foundation/privacybydesign/sms/TokenManager.java @@ -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 { diff --git a/src/main/java/foundation/privacybydesign/sms/ratelimit/RateLimitUtils.java b/src/main/java/foundation/privacybydesign/sms/ratelimit/RateLimitUtils.java index 46bcf2b..203ca0d 100644 --- a/src/main/java/foundation/privacybydesign/sms/ratelimit/RateLimitUtils.java +++ b/src/main/java/foundation/privacybydesign/sms/ratelimit/RateLimitUtils.java @@ -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(); diff --git a/src/main/java/foundation/privacybydesign/sms/ratelimit/RedisRateLimit.java b/src/main/java/foundation/privacybydesign/sms/ratelimit/RedisRateLimit.java index 2efb3ed..c9d76fe 100644 --- a/src/main/java/foundation/privacybydesign/sms/ratelimit/RedisRateLimit.java +++ b/src/main/java/foundation/privacybydesign/sms/ratelimit/RedisRateLimit.java @@ -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(); } @@ -164,6 +164,7 @@ protected synchronized void countPhone(String phone, long now) { } } + @Override public void periodicCleanup() { cleanUpIpLimits(); cleanUpPhoneLimits();