Massive speed up during invitation creation at the expense of reliability. Document method for creating a reliability manager of some sort
This commit is contained in:
@@ -173,7 +173,7 @@ export class AppService extends EventEmitter<AppEventMap> {
|
||||
|
||||
// Attach listeners before SSE connects so updates are not missed.
|
||||
await this.addInvitation(invitationInstance);
|
||||
await invitationInstance.start();
|
||||
invitationInstance.start();
|
||||
|
||||
return invitationInstance;
|
||||
}
|
||||
|
||||
@@ -224,12 +224,9 @@ export class Invitation extends EventEmitter<InvitationEventMap> {
|
||||
private async publishInvitation(
|
||||
invitation: XOInvitation = this.data,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await this.syncServer.publishInvitation(invitation);
|
||||
} catch (err) {
|
||||
// Emit the error event. We might want to throw? but we need a better way of handling errors in the invitation system because we need the invitation to successfully initialize.
|
||||
this.emit("error", err instanceof Error ? err : new Error(String(err)));
|
||||
}
|
||||
this.syncServer.publishInvitation(invitation).catch((error) => {
|
||||
this.emit("error", error instanceof Error ? error : new Error(String(error)));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -374,9 +371,13 @@ export class Invitation extends EventEmitter<InvitationEventMap> {
|
||||
* Update the status of the invitation and emit the new single-word status.
|
||||
*/
|
||||
private async updateStatus(): Promise<void> {
|
||||
const status = await this.computeStatus();
|
||||
this.status = status;
|
||||
this.emit("invitation-status-changed", status);
|
||||
this.computeStatus().then(status => {
|
||||
this.status = status;
|
||||
this.emit("invitation-status-changed", status);
|
||||
}).catch((error) => {
|
||||
this.status = `error (${error instanceof Error ? error.message : String(error)})`;
|
||||
this.emit("error", error instanceof Error ? error : new Error(String(error)));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user