@xuda.io/xuda-worker-bundle-min 1.3.353 → 1.3.355
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 +33 -20
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -370,23 +370,26 @@ func.common.db = async function (
|
|
|
370
370
|
try {
|
|
371
371
|
const doc = await db.get(rep_id);
|
|
372
372
|
if (doc.stat < 3) throw "replication not ready";
|
|
373
|
-
|
|
373
|
+
const json = await func.db.pouch[serviceP](SESSION_ID, dataP);
|
|
374
|
+
return success_callback(json, true);
|
|
374
375
|
} catch (err) {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
376
|
+
// try {
|
|
377
|
+
const json = await perform_rpi_request(serviceP);
|
|
378
|
+
if (json.opt) {
|
|
379
|
+
try {
|
|
380
|
+
await db.put({
|
|
381
|
+
_id: rep_id,
|
|
382
|
+
selector: json.opt.selector,
|
|
383
|
+
stat: 1,
|
|
384
|
+
ts: Date.now(),
|
|
385
|
+
});
|
|
386
|
+
} catch (err) {}
|
|
387
|
+
}
|
|
388
|
+
return success_callback(json, true);
|
|
389
|
+
// } catch (err) {
|
|
390
|
+
// return error_callback(err);
|
|
391
|
+
// }
|
|
384
392
|
}
|
|
385
|
-
|
|
386
|
-
return ret;
|
|
387
|
-
|
|
388
|
-
const ret = await func.db.pouch[serviceP](SESSION_ID, dataP);
|
|
389
|
-
return ret;
|
|
390
393
|
};
|
|
391
394
|
|
|
392
395
|
if (
|
|
@@ -400,11 +403,21 @@ func.common.db = async function (
|
|
|
400
403
|
serviceP
|
|
401
404
|
)
|
|
402
405
|
) {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
406
|
+
try {
|
|
407
|
+
const ret = {
|
|
408
|
+
code: 1,
|
|
409
|
+
data: await perform_rpi_request_from_pouch(serviceP),
|
|
410
|
+
};
|
|
411
|
+
return success_callback(ret);
|
|
412
|
+
} catch (err) {
|
|
413
|
+
return error_callback(err);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// const ret = {
|
|
417
|
+
// code: 1,
|
|
418
|
+
// data: await perform_rpi_request_from_pouch(serviceP),
|
|
419
|
+
// };
|
|
420
|
+
// return success_callback(ret);
|
|
408
421
|
}
|
|
409
422
|
try {
|
|
410
423
|
const json = await perform_rpi_request(serviceP);
|