Skip to content

Commit

Permalink
feat(CSVUpload): Submitted event is now saved before transactional wo…
Browse files Browse the repository at this point in the history
…rk for CSV feature uploads
  • Loading branch information
KevSanchez committed Apr 12, 2024
1 parent 31c3a27 commit cc408d8
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ export class FeatureAmountUploadService {
projectId: string;
userId: string;
}): Promise<Left<any> | Right<GeoFeature[]>> {
await this.events.submittedEvent(data.projectId, data);

const apiQueryRunner = this.apiDataSource.createQueryRunner();
const geoQueryRunner = this.geoDataSource.createQueryRunner();

Expand Down Expand Up @@ -151,14 +153,11 @@ export class FeatureAmountUploadService {
await apiQueryRunner.commitTransaction();
await geoQueryRunner.commitTransaction();

// This is done, for now, in order to avoid unnecessary polling from FE
await this.events.submittedEvent(data.projectId, data);
await this.events.finishEvent(data.projectId);
} catch (err) {
await apiQueryRunner.rollbackTransaction();
await geoQueryRunner.rollbackTransaction();
// This is done, for now, in order to avoid unnecessary polling from FE
await this.events.submittedEvent(data.projectId, data);

await this.events.failEvent(data.projectId, err);

this.logger.error(
Expand Down

0 comments on commit cc408d8

Please sign in to comment.