mirror of
https://github.com/BgaSol/sol-cloud
synced 2026-05-23 17:18:44 +00:00
refactor(auth): Optimize token refresh logic
This commit is contained in:
parent
adabbb45cd
commit
544b176783
1 changed files with 4 additions and 5 deletions
|
|
@ -29,11 +29,10 @@ public class SaSameTokenRefreshTask {
|
|||
@Scheduled(cron = "0 0 * * * ?")
|
||||
public void refreshToken() {
|
||||
RLock lock = redissonClient.getLock(LOCK_KEY);
|
||||
if (lock.tryLock(0, 5, TimeUnit.SECONDS)) {
|
||||
SaSameUtil.refreshToken();
|
||||
log.info("Token refresh token successful");
|
||||
} else {
|
||||
log.info("Lock not acquired");
|
||||
if (!lock.tryLock(0, 5, TimeUnit.SECONDS)) {
|
||||
return;
|
||||
}
|
||||
SaSameUtil.refreshToken();
|
||||
log.info("Token refresh token successful");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue