File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -253,20 +253,22 @@ def user_limit(self, request):
253
253
user = request .user_uid
254
254
255
255
limits = self .per_user_limits .get (user , [])
256
- if limits != []:
257
- print (user , limits )
258
- return limits
256
+ applied_limits = []
257
+ for limit in limits :
258
+ if limit .match (request ):
259
+ applied_limits .append (limit )
259
260
260
261
for limit in self .rules .user_limits :
261
262
if limit .match (request ):
262
263
"""
263
264
We clone the rule because we need one instance per different
264
265
user otherwise all users will share that limit
265
266
"""
266
- limit = limit .clone ()
267
- limits .append (limit )
268
- self .per_user_limits [user ] = limits
269
- return limits
267
+ if limit .get_uid (request ) not in [l .get_uid (request ) for l in limits ]:
268
+ limit = limit .clone ()
269
+ applied_limits .append (limit )
270
+ self .per_user_limits [user ] = self .per_user_limits .get (user , []) + [limit ]
271
+ return applied_limits
270
272
271
273
@locked
272
274
def pick (self , queue , session ):
You can’t perform that action at this time.
0 commit comments