diff options
author | crupest <crupest@outlook.com> | 2020-08-26 01:19:21 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-08-26 01:19:21 +0800 |
commit | 1886b3411c69d8eb4fffbbfe29eb3a917d04e2f4 (patch) | |
tree | 6a9e21ef9ca74c2306fd23b418d879a667abca81 /Timeline/ClientApp | |
parent | 35494ebade7722e02d0870eb6ce85600831c077d (diff) | |
download | timeline-1886b3411c69d8eb4fffbbfe29eb3a917d04e2f4.tar.gz timeline-1886b3411c69d8eb4fffbbfe29eb3a917d04e2f4.tar.bz2 timeline-1886b3411c69d8eb4fffbbfe29eb3a917d04e2f4.zip |
No longer wait for saving user, which may lead to delay.
Diffstat (limited to 'Timeline/ClientApp')
-rw-r--r-- | Timeline/ClientApp/src/app/data/timeline.ts | 6 | ||||
-rw-r--r-- | Timeline/ClientApp/src/app/data/user.ts | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/Timeline/ClientApp/src/app/data/timeline.ts b/Timeline/ClientApp/src/app/data/timeline.ts index 0e11b4e7..3eda35f9 100644 --- a/Timeline/ClientApp/src/app/data/timeline.ts +++ b/Timeline/ClientApp/src/app/data/timeline.ts @@ -152,7 +152,7 @@ export class TimelineService { try { const httpTimeline = await getHttpTimelineClient().getTimeline(key); - await userInfoService.saveUsers([ + userInfoService.saveUsers([ httpTimeline.owner, ...httpTimeline.members, ]); @@ -339,7 +339,7 @@ export class TimelineService { userService.currentUser?.token ); - await userInfoService.saveUsers( + userInfoService.saveUsers( uniqBy( httpPosts.map((post) => post.author), "username" @@ -368,7 +368,7 @@ export class TimelineService { (p): p is HttpTimelinePostInfo => !p.deleted ); - await userInfoService.saveUsers( + userInfoService.saveUsers( uniqBy( httpPosts .map((post) => post.author) diff --git a/Timeline/ClientApp/src/app/data/user.ts b/Timeline/ClientApp/src/app/data/user.ts index 66fcd83c..b8f163eb 100644 --- a/Timeline/ClientApp/src/app/data/user.ts +++ b/Timeline/ClientApp/src/app/data/user.ts @@ -226,16 +226,16 @@ export function checkLogin(): UserWithToken { export class UserNotExistError extends Error {} export class UserInfoService { - saveUser(user: HttpUser): Promise<void> { + saveUser(user: HttpUser): void { const key = user.username; - return this._userHub.optionalInitLineWithSyncAction(key, async (line) => { + void this._userHub.optionalInitLineWithSyncAction(key, async (line) => { await this.doSaveUser(user); line.next({ user, type: "synced" }); }); } - saveUsers(users: HttpUser[]): Promise<void> { - return Promise.all(users.map((user) => this.saveUser(user))).then(); + saveUsers(users: HttpUser[]): void { + return users.forEach((user) => this.saveUser(user)); } private getCachedUser(username: string): Promise<User | null> { @@ -364,7 +364,7 @@ export class UserInfoService { return getHttpUserClient() .patch(username, { nickname }, user.token) .then((user) => { - void this.saveUser(user); + this.saveUser(user); }); } } |