Skip to content

Commit 84e574f

Browse files
committed
Minor renaming.
1 parent 108799f commit 84e574f

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/main/java/org/barcodeapi/server/cache/LimiterCache.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,24 @@ public class LimiterCache {
3434
_LIMITERS = ObjectCache.getCache(ObjectCache.CACHE_LIMITERS);
3535
}
3636

37-
public static CachedLimiter getLimiter(Subscriber sub, String userID) {
37+
public static CachedLimiter getLimiter(Subscriber sub, String address) {
3838
LibMetrics.hitMethodRunCounter();
3939

4040
// Determine if limiter exists
4141
CachedLimiter limiter;
42-
if (_LIMITERS.has(userID)) {
42+
if (_LIMITERS.has(address)) {
4343

4444
// Get the existing limiter from the cache
45-
limiter = (CachedLimiter) _LIMITERS.get(userID);
45+
limiter = (CachedLimiter) _LIMITERS.get(address);
4646
} else {
4747

4848
// Determine enforce / limits for the new limiter
4949
int limit = (sub != null) ? sub.getLimit() : DEFLIMIT_RATE;
5050
boolean enforce = (sub != null) ? sub.isEnforced() : DEFLIMIT_ENFORCE;
5151

5252
// Create a new limiter and add it to the cache
53-
limiter = new CachedLimiter(enforce, userID, limit);
54-
_LIMITERS.put(userID, limiter);
53+
limiter = new CachedLimiter(enforce, address, limit);
54+
_LIMITERS.put(address, limiter);
5555
}
5656

5757
// Return the limiter

src/main/java/org/barcodeapi/server/core/RequestContext.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,9 @@ public RequestContext(Request request, boolean createSession) {
161161
user = SubscriberCache.getByIP(ip);
162162
}
163163

164-
// User ID based on customer association or IP
165-
String userID = (user != null) ? user.getCustomer() : ip;
166-
167164
this.admin = admin;
168165
this.subscriber = user;
169-
this.limiter = LimiterCache.getLimiter(user, userID);
166+
this.limiter = LimiterCache.getLimiter(user, ip);
170167

171168
// Get user session info
172169
CachedSession userSession = SessionHelper.getSession(request);

0 commit comments

Comments
 (0)