Skip to content

Commit

Permalink
feature(CSVImport): Moves the CSV Import event to the start of proces…
Browse files Browse the repository at this point in the history
…sing
  • Loading branch information
KevSanchez committed Apr 16, 2024
1 parent fe9087c commit 9b31036
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 9b31036

Please sign in to comment.