Merged
Conversation
…passed into `keepAliveLoop` function.
…rns error. See z4yx#40-L3. Add 2 setting items: `onlineRetry`, which determines the maximum retry number (default 2); `onlineInterval`, which controls the interval between two keepalive requests (default 3s). Note that this commit will change the behaviour of `auth-thu online`: When the device is not authed, now `auth-thu online` will exit after 3 seconds, but for previous behaviour, `auth-thu online` will exit immediately. For equivalent with previous behaviour, you should use `auth-thu online -r 1`.
…auth". Since legacy `auth-thu login` had been removed in 506a920, there should not be this legacy option too. To keep consistency with flags in `auth-thu auth`, the flag is renamed to "campus-only"; but for backward compatibility, "auth" is still kept as an alias.
Collaborator
Owner
|
Invited
Chen ***@***.***> 于 2025年2月11日周二 16:45写道:
… @z4yx <https://github.com/z4yx> Please invite @Starrah
<https://github.com/Starrah> as maintainer.
—
Reply to this email directly, view it on GitHub
<#45 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAU3JWZ3BV4JHUPPEI7TQJT2PG2BJAVCNFSM6AAAAABW4N4Y36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNJQGE2DINBZGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
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.
此前的讨论见#40。
根据 #40 (comment) 的建议,本PR实现了keepAliveLoop并不会在请求失败就立即退出,而是重复尝试可定义的次数,只有连续失败若干次后才会退出。同时,两次重试之间的时间间隔现在也可定义了(之前是写死的3s)。
具体实现:
auth-thu auth --keep-online的keepAlive,应该根据--campus-only的有无决定keepAlive的校内校外,而不应固定写死keepAlive校内。onlineRetry,决定keepAliveLoop在退出之前应当尝试的次数,默认值为2,即只有连续两次keepAlive请求报错,keepAliveLoop才会退出。onlineInterval,决定两次keepAlive请求之间的间隔,默认值为3s(和原来写死在代码里的值一致)auth-thu online --auth的--auth增加一个alias名为--campus-only。这是因为--auth原本在旧版的系统下表示只auth不login,但目前login功能已被完全移除,故该名称也失去了其含义;改为--campus-only,是和auth-thu auth中的同义选项保持一致的选择。Close #40.