|
@@ -18,8 +18,8 @@
|
|
|
<div class='progress-div'>
|
|
|
<div>
|
|
|
<span>
|
|
|
- 成功:
|
|
|
- <span style="color:green;">{{successNum}}</span>/{{allNum}}
|
|
|
+ 成功(含跳过):
|
|
|
+ <span style="color:green;">{{successNum}}({{skipNum}})</span>/{{allNum}}
|
|
|
</span>
|
|
|
<span>
|
|
|
失败:
|
|
@@ -29,6 +29,14 @@
|
|
|
并发请求:
|
|
|
<span style="color:black;">{{reqNum}}</span>
|
|
|
</span>
|
|
|
+ <span>
|
|
|
+ 并发报警:
|
|
|
+ <span style="color:red;">{{faceppConcurrencyErrorNum}}</span>
|
|
|
+ </span>
|
|
|
+ <span>
|
|
|
+ 报警频率:
|
|
|
+ <span style="color:red;">{{faceppConcurrencyErrorNumPerMinute}}个/分</span>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
<div>
|
|
|
<span>开始时间:{{startProcessTimeFormat}} </span>
|
|
@@ -83,7 +91,7 @@ function readImageFiles(folderPath) {
|
|
|
.map(fileName => folderPath + "/" + fileName);
|
|
|
}
|
|
|
|
|
|
-let CONCURRENCY = 2; //同时处理的照片数量; 深夜增加并发
|
|
|
+let CONCURRENCY = 4; //同时处理的照片数量; 深夜增加并发
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
@@ -95,11 +103,13 @@ export default {
|
|
|
skipNum: 0, //跳过数量
|
|
|
allNum: 0, //总数
|
|
|
completeShow: false,
|
|
|
- baseID: "", // 从大于这个身份证号开始处理
|
|
|
+ baseID: "", // 从大于这个身份证号开始处理,不能在init初始化
|
|
|
reqNum: 0, // 并发请求数
|
|
|
+ faceppConcurrencyErrorNum: 0, // face++的并发数报错
|
|
|
startProcessTime: null, // 开始处理的时间
|
|
|
endProcessTime: null, // 结束处理的时间
|
|
|
- processSpeed: 0 // 处理的速度:个/秒
|
|
|
+ processSpeed: 0, // 处理的速度:个/秒
|
|
|
+ faceppConcurrencyErrorNumPerMinute: 0 // 报警频率
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -108,12 +118,15 @@ export default {
|
|
|
this.returnMsgList = [];
|
|
|
this.successNum = 0;
|
|
|
this.errorNum = 0;
|
|
|
+ this.skipNum = 0;
|
|
|
this.allNum = 0;
|
|
|
this.completeShow = false;
|
|
|
this.reqNum = 0;
|
|
|
+ this.faceppConcurrencyErrorNum = 0;
|
|
|
this.startProcessTime = null;
|
|
|
this.endProcessTime = null;
|
|
|
this.processSpeed = 0;
|
|
|
+ window.faceppConcurrencyErrorNum = 0;
|
|
|
},
|
|
|
importPhotos() {
|
|
|
this.init();
|
|
@@ -139,25 +152,32 @@ export default {
|
|
|
let total = 0;
|
|
|
for (
|
|
|
let i = this.successNum + this.errorNum;
|
|
|
- i < this.photoList.length && total < 1000;
|
|
|
+ i < this.photoList.length && total < 100;
|
|
|
i++, total++
|
|
|
) {
|
|
|
taskQueue.push(this.processStudentPhoto.bind(this, this.photoList[i]));
|
|
|
}
|
|
|
this.processQueueSingle(taskQueue);
|
|
|
},
|
|
|
- processQueueSingle(taskQueue1000) {
|
|
|
+ processQueueSingle(taskQueue100) {
|
|
|
// 并发处理请求,可在控制台查看请求峰值
|
|
|
- CONCURRENCY = new Date().getHours() < 6 ? 9 : 7;
|
|
|
- async.parallelLimit(taskQueue1000, CONCURRENCY, (err, results) => {
|
|
|
+ // CONCURRENCY = new Date().getHours() < 6 ? 9 : 5;
|
|
|
+ if (window.faceppConcurrencyErrorNumPerMinute < 7 && CONCURRENCY < 9) {
|
|
|
+ CONCURRENCY++;
|
|
|
+ } else {
|
|
|
+ CONCURRENCY--;
|
|
|
+ }
|
|
|
+
|
|
|
+ async.parallelLimit(taskQueue100, CONCURRENCY, (err, results) => {
|
|
|
if (err) {
|
|
|
alert(err);
|
|
|
console.log(err);
|
|
|
} else {
|
|
|
console.log(results);
|
|
|
if (this.successNum + this.errorNum < this.allNum) {
|
|
|
- console.log("处理完1000张图片了,3秒后继续...");
|
|
|
- setTimeout(this.processQueue, 3000);
|
|
|
+ console.log("处理完100张图片了,3秒后继续...");
|
|
|
+ const delay = Date.now() - this.startProcessTime < 10000 ? 0 : 500; // 如果有跳过的图标则不等待0.5秒
|
|
|
+ setTimeout(this.processQueue, delay);
|
|
|
} else {
|
|
|
console.log("photoList处理完毕");
|
|
|
this.endProcessTime = Date.now();
|
|
@@ -181,6 +201,9 @@ export default {
|
|
|
const photoFile = fs.readFileSync(studentPhotoPath);
|
|
|
const rootOrgId = localStorage.getItem("rootOrgId");
|
|
|
this.reqNum = window.requestInProcessingTotal;
|
|
|
+ this.faceppConcurrencyErrorNum = window.faceppConcurrencyErrorNum;
|
|
|
+ this.faceppConcurrencyErrorNumPerMinute =
|
|
|
+ window.faceppConcurrencyErrorNumPerMinute;
|
|
|
|
|
|
this.processSpeed =
|
|
|
(this.successNum + this.errorNum - this.skipNum) /
|