fix: pass token_proxy into register_one to avoid NameError#2
Open
Leslielu wants to merge 1 commit into
Open
Conversation
register_one referenced token_proxy, which is only defined in main()'s scope and is neither a parameter nor a global. On any successful registration, the line `token_data["proxy"] = token_proxy` raised NameError, which the surrounding except swallowed as a retry — so every registration failed at the final step and the run ended with 0 registered. Add token_proxy as a parameter to register_one and pass it from main(). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 Walkthrough概览在 变更token_proxy 参数传递修复
预计审查工作量🎯 1 (Trivial) | ⏱️ ~3 分钟 诗
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1
问题
register_one()在注册成功后执行token_data["proxy"] = token_proxy(reg_distributed.py:138),但token_proxy只在main()作用域里定义,既不是该函数的参数也不是全局变量。因此任何一次成功注册都会抛NameError: name 'token_proxy' is not defined,异常被函数内的except当作重试吞掉,最终表现为每次注册都在最后一步失败、0 registered。修改
给
register_one()增加token_proxy参数,并在main()调用处传入。两行改动,无行为副作用:之前能跑通的路径不受影响,原本会崩的成功路径现在能正确把 token 的 proxy 写入并返回。验证
应用此修复后,注册流程可以完整跑通到
register_account返回并成功写出 token(此前在该步必崩)。Summary by CodeRabbit
发布说明