Skip to content

Commit

Permalink
dev (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
scx567888 authored Mar 18, 2024
1 parent c15cf2e commit 21e1456
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package cool.scx.live_room_watcher;

import cool.scx.live_room_watcher.util.Helper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

Expand All @@ -10,6 +12,8 @@
* 官方的被动接受的接口
*/
public abstract class AccessTokenManager {

final Logger logger= LoggerFactory.getLogger(this.getClass());

protected String accessToken;

Expand All @@ -34,6 +38,7 @@ public synchronized String getAccessToken() {
public synchronized void refreshAccessToken() {
try {
var accessToken0 = getAccessToken0();
logger.debug("获取 accessToken 成功 : {}",accessToken0);
this.accessToken = accessToken0.accessToken();
Helper.SCHEDULER.schedule(this::refreshAccessToken, accessToken0.expiresIn() / 2, SECONDS);
} catch (IllegalArgumentException e) {
Expand Down

0 comments on commit 21e1456

Please sign in to comment.