Skip to content

Commit afd61c9

Browse files
committed
fix(subscription): simplify HWID limit check logic
- Replace conditional pass statement with explicit limit validation - Check if limit is not None and greater than 0 before enforcing device limit - Improve code clarity by removing unnecessary else branch - Maintain existing behavior while reducing conditional complexity
1 parent a942bf6 commit afd61c9

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

app/operation/subscription.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,7 @@ async def validate_and_register_hwid(
306306

307307
# It's a new HWID, check limit
308308
limit = user_hwid_limit if user_hwid_limit is not None else effective_hwid_conf.fallback_limit
309-
if limit == 0:
310-
pass # unlimited
311-
else:
309+
if limit is not None and limit > 0:
312310
current_count = await get_user_hwid_count(db, user_id)
313311
if current_count >= limit:
314312
await self.raise_error(message="Device limit reached", code=403)

0 commit comments

Comments
 (0)