@satorijs/adapter-lark 3.9.3 → 3.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +1 -1
- package/package.json +1 -1
- package/src/bot.ts +5 -4
package/lib/index.cjs
CHANGED
|
@@ -923,7 +923,7 @@ var LarkBot = class extends import_core5.Bot {
|
|
|
923
923
|
this.logger.debug("refreshed token %s", token);
|
|
924
924
|
this.token = token;
|
|
925
925
|
if (this._refresher) clearTimeout(this._refresher);
|
|
926
|
-
this._refresher = setTimeout(() => this.refreshToken(), import_core5.Time.minute *
|
|
926
|
+
this._refresher = setTimeout(() => this.refreshToken(), import_core5.Time.minute * 20);
|
|
927
927
|
this.online();
|
|
928
928
|
}
|
|
929
929
|
get token() {
|
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -80,12 +80,13 @@ export class LarkBot<C extends Context = Context> extends Bot<C, LarkBot.Config>
|
|
|
80
80
|
})
|
|
81
81
|
this.logger.debug('refreshed token %s', token)
|
|
82
82
|
this.token = token
|
|
83
|
+
if (this._refresher) clearTimeout(this._refresher)
|
|
84
|
+
// https://open.feishu.cn/document/server-docs/authentication-management/access-token/tenant_access_token_internal
|
|
83
85
|
// tenant_access_token 的最大有效期是 2 小时。
|
|
84
|
-
// 剩余有效期小于 30 分钟时,调用本接口会返回一个新的 tenant_access_token
|
|
86
|
+
// 剩余有效期小于 30 分钟时,调用本接口会返回一个新的 tenant_access_token,此时会同时存在两个有效的 tenant_access_token。
|
|
85
87
|
// 剩余有效期大于等于 30 分钟时,调用本接口会返回原有的 tenant_access_token。
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
this._refresher = setTimeout(() => this.refreshToken(), Time.minute * 100)
|
|
88
|
+
// 初次获得 token 后的半小时内必须刷新一次,因为初次获得的 token 可能是 1.5 小时前生成的。
|
|
89
|
+
this._refresher = setTimeout(() => this.refreshToken(), Time.minute * 20)
|
|
89
90
|
this.online()
|
|
90
91
|
}
|
|
91
92
|
|