feature-token

This commit is contained in:
Xu Chang 2022-09-14 11:12:56 +08:00
parent c1908eceeb
commit a358eebbc9
2 changed files with 5 additions and 4 deletions

View File

@ -26,8 +26,9 @@ var Token = /** @class */ (function (_super) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
this.rwLock.acquire('X');
case 0: return [4 /*yield*/, this.rwLock.acquire('X')];
case 1:
_a.sent();
return [4 /*yield*/, this.cache.refresh('token', {
data: {
id: 1,
@ -49,7 +50,7 @@ var Token = /** @class */ (function (_super) {
id: this.token,
},
})];
case 1:
case 2:
_a.sent();
this.rwLock.release();
return [2 /*return*/];

View File

@ -42,7 +42,7 @@ export class Token<
}
async loadTokenInfo() {
this.rwLock.acquire('X');
await this.rwLock.acquire('X');
await this.cache.refresh('token', {
data: {
id: 1,