shorten cycle
This commit is contained in:
parent
4813ac39e3
commit
baf8da9268
6
auth.go
6
auth.go
@ -56,8 +56,8 @@ func scheduleToken() {
|
|||||||
} else {
|
} else {
|
||||||
nowTime := time.Now()
|
nowTime := time.Now()
|
||||||
usedTime := nowTime.Sub(stat.ModTime())
|
usedTime := nowTime.Sub(stat.ModTime())
|
||||||
// update access token 20 days after last modify token file
|
// update access token 14 days after last modify token file
|
||||||
toExpire := 1.728e15 - usedTime
|
toExpire := 1.2096e15 - usedTime
|
||||||
if toExpire > 0 {
|
if toExpire > 0 {
|
||||||
file, err := os.Open("access_tokens.json")
|
file, err := os.Open("access_tokens.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -147,5 +147,5 @@ func updateToken() {
|
|||||||
}
|
}
|
||||||
// Append access token to access_tokens.json
|
// Append access token to access_tokens.json
|
||||||
ACCESS_TOKENS = tokens.NewAccessToken(token_list, true)
|
ACCESS_TOKENS = tokens.NewAccessToken(token_list, true)
|
||||||
time.AfterFunc(1.728e15, updateToken)
|
time.AfterFunc(1.2096e15, updateToken)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user