Skip to content

Commit

Permalink
do not auto upload recording
Browse files Browse the repository at this point in the history
  • Loading branch information
an-lee committed Feb 19, 2024
1 parent 6e406cf commit 7ca6731
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions enjoy/src/main/db/models/recording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,10 @@ export class Recording extends Model<Recording> {
}

async sync() {
this.upload().catch(() => {});

const webApi = new Client({
baseUrl: process.env.WEB_API_URL || WEB_API_URL,
accessToken: settings.getSync("user.accessToken") as string,
logger: log.scope("recording/sync"),
logger,
});

return webApi.syncRecording(this.toJSON()).then(() => {
Expand All @@ -156,11 +154,12 @@ export class Recording extends Model<Recording> {
return assessment;
}

await this.upload();
await this.sync();
const webApi = new Client({
baseUrl: process.env.WEB_API_URL || WEB_API_URL,
accessToken: settings.getSync("user.accessToken") as string,
logger: log.scope("recording/assess"),
logger,
});

const { token, region } = await webApi.generateSpeechToken();
Expand Down Expand Up @@ -221,7 +220,7 @@ export class Recording extends Model<Recording> {

@AfterCreate
static autoSync(recording: Recording) {
// auto upload should not block the main thread
// auto sync should not block the main thread
recording.sync().catch(() => {});
}

Expand Down

0 comments on commit 7ca6731

Please sign in to comment.