esoftplay 0.0.111-b → 0.0.111-e
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/esp.ts +1 -1
- package/modules/lib/curl.ts +16 -4
- package/package.json +1 -1
package/esp.ts
CHANGED
|
@@ -8,7 +8,7 @@ import routers from './cache/routers';
|
|
|
8
8
|
import './oneplusfixfont';
|
|
9
9
|
LogBox.ignoreLogs(['YellowBox has been replaced with LogBox. Please call LogBox.ignoreLogs() instead.']);
|
|
10
10
|
LogBox.ignoreLogs(['VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead.']);
|
|
11
|
-
LogBox.ignoreLogs([`Got a component with the name 'm'
|
|
11
|
+
LogBox.ignoreLogs([`Got a component with the name 'm'`]);
|
|
12
12
|
let app = require('../../app.json');
|
|
13
13
|
let conf = require('../../config.json');
|
|
14
14
|
let lconf
|
package/modules/lib/curl.ts
CHANGED
|
@@ -9,6 +9,7 @@ const { manifest } = Constants;
|
|
|
9
9
|
|
|
10
10
|
export default class ecurl {
|
|
11
11
|
timeout = 55000;
|
|
12
|
+
maxRetry = 2;
|
|
12
13
|
timeoutContext: any = null;
|
|
13
14
|
isDebug = esp.config("isDebug");
|
|
14
15
|
post: any;
|
|
@@ -29,6 +30,7 @@ export default class ecurl {
|
|
|
29
30
|
|
|
30
31
|
constructor(uri?: string, post?: any, onDone?: (res: any, msg: string) => void, onFailed?: (msg: string, timeout: boolean) => void, debug?: number) {
|
|
31
32
|
this.header = {}
|
|
33
|
+
this.maxRetry = 2;
|
|
32
34
|
this.setUri = this.setUri.bind(this);
|
|
33
35
|
this.setUrl = this.setUrl.bind(this);
|
|
34
36
|
this.buildUri = this.buildUri.bind(this);
|
|
@@ -59,7 +61,6 @@ export default class ecurl {
|
|
|
59
61
|
this.cancelTimeout()
|
|
60
62
|
this.timeoutContext = setTimeout(() => {
|
|
61
63
|
if (this.abort?.cancel) {
|
|
62
|
-
// reportApiError(`Request timeout`, this.url + this.uri)
|
|
63
64
|
this.closeConnection()
|
|
64
65
|
LibProgress.hide()
|
|
65
66
|
}
|
|
@@ -190,7 +191,13 @@ export default class ecurl {
|
|
|
190
191
|
onFailed(this.refineErrorMessage(msg), false)
|
|
191
192
|
}, debug)
|
|
192
193
|
}).catch((r: string) => {
|
|
193
|
-
this.cancelTimeout();
|
|
194
|
+
this.cancelTimeout();
|
|
195
|
+
if (this.maxRetry > 0) {
|
|
196
|
+
this.init(uri, post, onDone, onFailed, debug)
|
|
197
|
+
this.maxRetry = this.maxRetry - 1
|
|
198
|
+
} else {
|
|
199
|
+
this.onFetched(r, onDone, onFailed, debug)
|
|
200
|
+
}
|
|
194
201
|
LibProgress.hide()
|
|
195
202
|
this.onFetchFailed(r)
|
|
196
203
|
})
|
|
@@ -369,7 +376,7 @@ export default class ecurl {
|
|
|
369
376
|
// console.log(this.url + this.uri, { ...options, cancelToken: undefined })
|
|
370
377
|
// }
|
|
371
378
|
|
|
372
|
-
if (esp.isDebug('apitest') && manifest?.packagerOpts?.dev) {
|
|
379
|
+
if (esp.isDebug('apitest') && manifest?.packagerOpts?.dev && LogStateProperty) {
|
|
373
380
|
const allData = LogStateProperty.state().get() || []
|
|
374
381
|
const logEnable = LogStateProperty.enableLog().get()
|
|
375
382
|
|
|
@@ -406,7 +413,12 @@ export default class ecurl {
|
|
|
406
413
|
this.onFetched(res.data, onDone, onFailed, debug)
|
|
407
414
|
}).catch((e: any) => {
|
|
408
415
|
this.cancelTimeout()
|
|
409
|
-
this.
|
|
416
|
+
if (this.maxRetry > 0) {
|
|
417
|
+
this.init(uri, post, onDone, onFailed, debug)
|
|
418
|
+
this.maxRetry = this.maxRetry - 1
|
|
419
|
+
} else {
|
|
420
|
+
this.onFetched(e, onDone, onFailed, debug)
|
|
421
|
+
}
|
|
410
422
|
})
|
|
411
423
|
}
|
|
412
424
|
|