update verssion
This commit is contained in:
parent
4466e31a81
commit
31a6bacb0b
|
|
@ -207,29 +207,18 @@ ${result.message}
|
||||||
|
|
||||||
async createAndSendToZulip({ data }: CreateBulkMessageDto) {
|
async createAndSendToZulip({ data }: CreateBulkMessageDto) {
|
||||||
const results = [];
|
const results = [];
|
||||||
let iterationCount = 0; // Đếm số lần lặp
|
|
||||||
|
|
||||||
// Đảo ngược array trước khi xử lý
|
// Đảo ngược array trước khi xử lý
|
||||||
// const reversedData = [...data].reverse();
|
// const reversedData = [...data].reverse();
|
||||||
|
|
||||||
for (const mes of data) {
|
for (const mes of data) {
|
||||||
iterationCount++; // Tăng biến đếm mỗi lần lặp
|
|
||||||
|
|
||||||
const result = await this.create(mes);
|
const result = await this.create(mes);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
results.push(result);
|
results.push(result);
|
||||||
|
|
||||||
// Nếu result có exit = true thì dừng vòng lặp
|
|
||||||
if (result.exit === true) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return results;
|
||||||
results,
|
|
||||||
iterationCount, // Trả về kèm số lần lặp
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue