修复 OAuth 登录时轮询过于频繁的问题 (#3490)

* 修复 OAuth 登录时轮询过于频繁的问题

* update
This commit is contained in:
Glavo
2024-12-09 17:47:42 +08:00
committed by GitHub
parent 727e6746d2
commit 8460df7d5d

View File

@@ -109,7 +109,7 @@ public class OAuth {
options.callback.openBrowser(deviceTokenResponse.verificationURI); options.callback.openBrowser(deviceTokenResponse.verificationURI);
long startTime = System.nanoTime(); long startTime = System.nanoTime();
int interval = deviceTokenResponse.interval; long interval = TimeUnit.MILLISECONDS.convert(deviceTokenResponse.interval, TimeUnit.SECONDS);
while (true) { while (true) {
Thread.sleep(Math.max(interval, 1)); Thread.sleep(Math.max(interval, 1));
@@ -138,7 +138,7 @@ public class OAuth {
} }
if ("slow_down".equals(tokenResponse.error)) { if ("slow_down".equals(tokenResponse.error)) {
interval += 5; interval += 5000;
continue; continue;
} }