remove useless async/await from charts
This commit is contained in:
parent
41e50eeb0e
commit
fe25e6f367
15 changed files with 54 additions and 54 deletions
|
|
@ -50,9 +50,9 @@ export default class ActiveUsersChart extends Chart<typeof schema> { // eslint-d
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async read(user: { id: MiUser['id'], host: null }): Promise<void> {
|
||||
public read(user: { id: MiUser['id'], host: null }): void {
|
||||
const createdAt = this.idService.parse(user.id).date;
|
||||
await this.commit({
|
||||
this.commit({
|
||||
'read': [user.id],
|
||||
'registeredWithinWeek': (this.timeService.now - createdAt.getTime() < week) ? [user.id] : [],
|
||||
'registeredWithinMonth': (this.timeService.now - createdAt.getTime() < month) ? [user.id] : [],
|
||||
|
|
@ -64,8 +64,8 @@ export default class ActiveUsersChart extends Chart<typeof schema> { // eslint-d
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async write(user: { id: MiUser['id'], host: null }): Promise<void> {
|
||||
await this.commit({
|
||||
public write(user: { id: MiUser['id'], host: null }): void {
|
||||
this.commit({
|
||||
'write': [user.id],
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,22 +43,22 @@ export default class ApRequestChart extends Chart<typeof schema> { // eslint-dis
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async deliverSucc(): Promise<void> {
|
||||
await this.commit({
|
||||
public deliverSucc(): void {
|
||||
this.commit({
|
||||
'deliverSucceeded': 1,
|
||||
});
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async deliverFail(): Promise<void> {
|
||||
await this.commit({
|
||||
public deliverFail(): void {
|
||||
this.commit({
|
||||
'deliverFailed': 1,
|
||||
});
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async inbox(): Promise<void> {
|
||||
await this.commit({
|
||||
public inbox(): void {
|
||||
this.commit({
|
||||
'inboxReceived': 1,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ export default class DriveChart extends Chart<typeof schema> { // eslint-disable
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async update(file: MiDriveFile, isAdditional: boolean): Promise<void> {
|
||||
public update(file: MiDriveFile, isAdditional: boolean): void {
|
||||
const fileSizeKb = file.size / 1000;
|
||||
await this.commit(file.userHost === null ? {
|
||||
this.commit(file.userHost === null ? {
|
||||
'local.incCount': isAdditional ? 1 : 0,
|
||||
'local.incSize': isAdditional ? fileSizeKb : 0,
|
||||
'local.decCount': isAdditional ? 0 : 1,
|
||||
|
|
|
|||
|
|
@ -118,8 +118,8 @@ export default class FederationChart extends Chart<typeof schema> { // eslint-di
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async deliverd(host: string, succeeded: boolean): Promise<void> {
|
||||
await this.commit(succeeded ? {
|
||||
public deliverd(host: string, succeeded: boolean): void {
|
||||
this.commit(succeeded ? {
|
||||
'deliveredInstances': [host],
|
||||
} : {
|
||||
'stalled': [host],
|
||||
|
|
@ -127,8 +127,8 @@ export default class FederationChart extends Chart<typeof schema> { // eslint-di
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async inbox(host: string): Promise<void> {
|
||||
await this.commit({
|
||||
public inbox(host: string): void {
|
||||
this.commit({
|
||||
'inboxInstances': [host],
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,31 +80,31 @@ export default class InstanceChart extends Chart<typeof schema> { // eslint-disa
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async requestReceived(host: string): Promise<void> {
|
||||
await this.commit({
|
||||
public requestReceived(host: string): void {
|
||||
this.commit({
|
||||
'requests.received': 1,
|
||||
}, this.utilityService.toPuny(host));
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async requestSent(host: string, isSucceeded: boolean): Promise<void> {
|
||||
await this.commit({
|
||||
public requestSent(host: string, isSucceeded: boolean): void {
|
||||
this.commit({
|
||||
'requests.succeeded': isSucceeded ? 1 : 0,
|
||||
'requests.failed': isSucceeded ? 0 : 1,
|
||||
}, this.utilityService.toPuny(host));
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async newUser(host: string): Promise<void> {
|
||||
await this.commit({
|
||||
public newUser(host: string): void {
|
||||
this.commit({
|
||||
'users.total': 1,
|
||||
'users.inc': 1,
|
||||
}, this.utilityService.toPuny(host));
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async updateNote(host: string, note: MiNote, isAdditional: boolean): Promise<void> {
|
||||
await this.commit({
|
||||
public updateNote(host: string, note: MiNote, isAdditional: boolean): void {
|
||||
this.commit({
|
||||
'notes.total': isAdditional ? 1 : -1,
|
||||
'notes.inc': isAdditional ? 1 : 0,
|
||||
'notes.dec': isAdditional ? 0 : 1,
|
||||
|
|
@ -116,8 +116,8 @@ export default class InstanceChart extends Chart<typeof schema> { // eslint-disa
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async updateFollowing(host: string, isAdditional: boolean): Promise<void> {
|
||||
await this.commit({
|
||||
public updateFollowing(host: string, isAdditional: boolean): void {
|
||||
this.commit({
|
||||
'following.total': isAdditional ? 1 : -1,
|
||||
'following.inc': isAdditional ? 1 : 0,
|
||||
'following.dec': isAdditional ? 0 : 1,
|
||||
|
|
@ -125,8 +125,8 @@ export default class InstanceChart extends Chart<typeof schema> { // eslint-disa
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async updateFollowers(host: string, isAdditional: boolean): Promise<void> {
|
||||
await this.commit({
|
||||
public updateFollowers(host: string, isAdditional: boolean): void {
|
||||
this.commit({
|
||||
'followers.total': isAdditional ? 1 : -1,
|
||||
'followers.inc': isAdditional ? 1 : 0,
|
||||
'followers.dec': isAdditional ? 0 : 1,
|
||||
|
|
@ -134,9 +134,9 @@ export default class InstanceChart extends Chart<typeof schema> { // eslint-disa
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async updateDrive(file: MiDriveFile, isAdditional: boolean): Promise<void> {
|
||||
public updateDrive(file: MiDriveFile, isAdditional: boolean): void {
|
||||
const fileSizeKb = file.size / 1000;
|
||||
await this.commit({
|
||||
this.commit({
|
||||
'drive.totalFiles': isAdditional ? 1 : -1,
|
||||
'drive.incFiles': isAdditional ? 1 : 0,
|
||||
'drive.incUsage': isAdditional ? fileSizeKb : 0,
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ export default class NotesChart extends Chart<typeof schema> { // eslint-disable
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async update(note: MiNote, isAdditional: boolean): Promise<void> {
|
||||
public update(note: MiNote, isAdditional: boolean): void {
|
||||
const prefix = note.userHost === null ? 'local' : 'remote';
|
||||
|
||||
await this.commit({
|
||||
this.commit({
|
||||
[`${prefix}.total`]: isAdditional ? 1 : -1,
|
||||
[`${prefix}.inc`]: isAdditional ? 1 : 0,
|
||||
[`${prefix}.dec`]: isAdditional ? 0 : 1,
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ export default class PerUserDriveChart extends Chart<typeof schema> { // eslint-
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async update(file: MiDriveFile, isAdditional: boolean): Promise<void> {
|
||||
public update(file: MiDriveFile, isAdditional: boolean): void {
|
||||
const fileSizeKb = file.size / 1000;
|
||||
await this.commit({
|
||||
this.commit({
|
||||
'totalCount': isAdditional ? 1 : -1,
|
||||
'totalSize': isAdditional ? fileSizeKb : -fileSizeKb,
|
||||
'incCount': isAdditional ? 1 : 0,
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ export default class PerUserFollowingChart extends Chart<typeof schema> { // esl
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async update(follower: { id: MiUser['id']; host: MiUser['host']; }, followee: { id: MiUser['id']; host: MiUser['host']; }, isFollow: boolean): Promise<void> {
|
||||
public update(follower: { id: MiUser['id']; host: MiUser['host']; }, followee: { id: MiUser['id']; host: MiUser['host']; }, isFollow: boolean): void {
|
||||
const prefixFollower = this.userEntityService.isLocalUser(follower) ? 'local' : 'remote';
|
||||
const prefixFollowee = this.userEntityService.isLocalUser(followee) ? 'local' : 'remote';
|
||||
|
||||
|
|
|
|||
|
|
@ -44,16 +44,16 @@ export default class PerUserPvChart extends Chart<typeof schema> { // eslint-dis
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async commitByUser(user: { id: MiUser['id'] }, key: string): Promise<void> {
|
||||
await this.commit({
|
||||
public commitByUser(user: { id: MiUser['id'] }, key: string): void {
|
||||
this.commit({
|
||||
'upv.user': [key],
|
||||
'pv.user': 1,
|
||||
}, user.id);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async commitByVisitor(user: { id: MiUser['id'] }, key: string): Promise<void> {
|
||||
await this.commit({
|
||||
public commitByVisitor(user: { id: MiUser['id'] }, key: string): void {
|
||||
this.commit({
|
||||
'upv.visitor': [key],
|
||||
'pv.visitor': 1,
|
||||
}, user.id);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export default class PerUserReactionsChart extends Chart<typeof schema> { // esl
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async update(user: { id: MiUser['id'], host: MiUser['host'] }, note: MiNote): Promise<void> {
|
||||
public update(user: { id: MiUser['id'], host: MiUser['host'] }, note: MiNote): void {
|
||||
const prefix = this.userEntityService.isLocalUser(user) ? 'local' : 'remote';
|
||||
this.commit({
|
||||
[`${prefix}.count`]: 1,
|
||||
|
|
|
|||
|
|
@ -48,12 +48,12 @@ export default class TestGroupedChart extends Chart<typeof schema> { // eslint-d
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async increment(group: string): Promise<void> {
|
||||
public increment(group: string): void {
|
||||
if (this.total[group] == null) this.total[group] = 0;
|
||||
|
||||
this.total[group]++;
|
||||
|
||||
await this.commit({
|
||||
this.commit({
|
||||
'foo.total': 1,
|
||||
'foo.inc': 1,
|
||||
}, group);
|
||||
|
|
|
|||
|
|
@ -44,15 +44,15 @@ export default class TestIntersectionChart extends Chart<typeof schema> { // esl
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async addA(key: string): Promise<void> {
|
||||
await this.commit({
|
||||
public addA(key: string): void {
|
||||
this.commit({
|
||||
a: [key],
|
||||
});
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async addB(key: string): Promise<void> {
|
||||
await this.commit({
|
||||
public addB(key: string): void {
|
||||
this.commit({
|
||||
b: [key],
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ export default class TestUniqueChart extends Chart<typeof schema> { // eslint-di
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async uniqueIncrement(key: string): Promise<void> {
|
||||
await this.commit({
|
||||
public uniqueIncrement(key: string): void {
|
||||
this.commit({
|
||||
foo: [key],
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,20 +48,20 @@ export default class TestChart extends Chart<typeof schema> { // eslint-disable-
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async increment(): Promise<void> {
|
||||
public increment(): void {
|
||||
this.total++;
|
||||
|
||||
await this.commit({
|
||||
this.commit({
|
||||
'foo.total': 1,
|
||||
'foo.inc': 1,
|
||||
});
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async decrement(): Promise<void> {
|
||||
public decrement(): void {
|
||||
this.total--;
|
||||
|
||||
await this.commit({
|
||||
this.commit({
|
||||
'foo.total': -1,
|
||||
'foo.dec': 1,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ export default class UsersChart extends Chart<typeof schema> { // eslint-disable
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async update(user: { id: MiUser['id'], host: MiUser['host'] }, isAdditional: boolean): Promise<void> {
|
||||
public update(user: { id: MiUser['id'], host: MiUser['host'] }, isAdditional: boolean): void {
|
||||
const prefix = this.userEntityService.isLocalUser(user) ? 'local' : 'remote';
|
||||
|
||||
await this.commit({
|
||||
this.commit({
|
||||
[`${prefix}.total`]: isAdditional ? 1 : -1,
|
||||
[`${prefix}.inc`]: isAdditional ? 1 : 0,
|
||||
[`${prefix}.dec`]: isAdditional ? 0 : 1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue