Skip to content

Commit

Permalink
Fix: frequent polling during OAuth login
Browse files Browse the repository at this point in the history
  • Loading branch information
ShirosakiMio committed Dec 11, 2024
1 parent 881bbc6 commit 065540c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions FCLCore/src/main/java/com/tungsten/fclcore/auth/OAuth.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private Result authenticateDevice(Options options) throws IOException, Interrupt
options.callback.openBrowser(deviceTokenResponse.verificationURI);

long startTime = System.nanoTime();
int interval = deviceTokenResponse.interval;
long interval = TimeUnit.MILLISECONDS.convert(deviceTokenResponse.interval, TimeUnit.SECONDS);

while (true) {
Thread.sleep(Math.max(interval, 1));
Expand Down Expand Up @@ -138,7 +138,7 @@ private Result authenticateDevice(Options options) throws IOException, Interrupt
}

if ("slow_down".equals(tokenResponse.error)) {
interval += 5;
interval += 5000;
continue;
}

Expand Down

0 comments on commit 065540c

Please sign in to comment.