@xuda.io/xuda-worker-bundle-min 1.3.380 → 1.3.382
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +36 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -366,10 +366,45 @@ func.common.db = async function (
|
|
|
366
366
|
const perform_rpi_request_from_pouch = async function (serviceP) {
|
|
367
367
|
const db = await func.utils.connect_pouchdb(SESSION_ID);
|
|
368
368
|
let _data = _.cloneDeep(dataP);
|
|
369
|
+
|
|
370
|
+
//{\"key\":\"1629087992397\",\"limit\":99999999,\"skip\":null,\"table_id\":\"1629087992397\"}"
|
|
371
|
+
|
|
369
372
|
delete _data.fields;
|
|
370
373
|
delete _data.viewSourceDesc;
|
|
374
|
+
if (_data.skip === null) {
|
|
375
|
+
delete _data.skip;
|
|
376
|
+
}
|
|
371
377
|
const rep_id = JSON.stringify(_data);
|
|
372
|
-
|
|
378
|
+
|
|
379
|
+
////// validate existence of whole table request
|
|
380
|
+
|
|
381
|
+
try {
|
|
382
|
+
let table_req_id = JSON.stringify({
|
|
383
|
+
table_id: _data.table_id,
|
|
384
|
+
limit: 99999999,
|
|
385
|
+
key: _data.table_id,
|
|
386
|
+
});
|
|
387
|
+
const doc = await db.get(table_req_id);
|
|
388
|
+
/// delete all requests
|
|
389
|
+
|
|
390
|
+
let ret = await db.find({
|
|
391
|
+
selector: {
|
|
392
|
+
docType: "rep_request",
|
|
393
|
+
"udfData.udffileid": _data.table_id,
|
|
394
|
+
},
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
for (let doc of ret.docs) {
|
|
398
|
+
console.log("to remove", doc);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (doc.stat < 3) {
|
|
402
|
+
return await perform_rpi_request(serviceP);
|
|
403
|
+
}
|
|
404
|
+
} catch (err) {}
|
|
405
|
+
|
|
406
|
+
///////////////////////////
|
|
407
|
+
|
|
373
408
|
try {
|
|
374
409
|
const doc = await db.get(rep_id);
|
|
375
410
|
if (doc.stat < 3) throw "replication not ready";
|