Skip to content

Commit b8073c8

Browse files
author
Gerald Baulig
committed
fix(offset): use latest
1 parent 8b6c056 commit b8073c8

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

cfg/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"localhost:29092"
6767
]
6868
},
69-
"latestOffset": false,
69+
"latestOffset": true,
7070
"orderCreated": {
7171
"messageObject": "io.restorecommerce.order.Order"
7272
},

src/service.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -1722,17 +1722,6 @@ export class OrderingService
17221722
}
17231723
);
17241724
}
1725-
1726-
Object.values(response_map).forEach(
1727-
item => {
1728-
if (item.status?.code !== 200 && 'INVALID' in this.emitters) {
1729-
this.orderingTopic.emit(this.emitters['INVALID'], item);
1730-
}
1731-
else if (item.payload?.order_state in this.emitters) {
1732-
this.orderingTopic.emit(this.emitters[item.payload.order_state], item.payload);
1733-
}
1734-
}
1735-
);
17361725

17371726
if (this.notification_service) {
17381727
this.logger?.debug('Send notifications on submit...');
@@ -1783,6 +1772,17 @@ export class OrderingService
17831772
}
17841773
));
17851774
}
1775+
1776+
await Promise.all(Object.values(response_map).map(
1777+
async item => {
1778+
if (item.status?.code !== 200 && 'INVALID' in this.emitters) {
1779+
await this.orderingTopic.emit(this.emitters['INVALID'], item);
1780+
}
1781+
else if (item.payload?.order_state in this.emitters) {
1782+
await this.orderingTopic.emit(this.emitters[item.payload.order_state], item.payload);
1783+
}
1784+
}
1785+
));
17861786
}
17871787
catch (error: any) {
17881788
response.operation_status = this.catchOperationError(error)?.operation_status;

test/ordering-srv.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ describe('The Ordering Service:', () => {
216216

217217
for (let [sample_name, sample] of Object.entries(samples.orders.valid)) {
218218
it(`should submit valid orders by sample: ${sample_name}`, async function() {
219-
this.timeout(5000);
219+
this.timeout(30000);
220220
const response = await client.submit(sample);
221221
should.equal(
222222
response.operationStatus?.code,

0 commit comments

Comments
 (0)