@@ -34,7 +34,7 @@ export default class ReactDatabaseSupplier {
34
34
static KEY_COLUMN = "key" ;
35
35
static VALUE_COLUMN = "value"
36
36
private DATABASE_VERSION = 1 ;
37
- private SLEEP_TIME_MS = 30 ;
37
+ private SLEEP_TIME_MS = 50 ;
38
38
private VERSION_TABLE_CREATE =
39
39
"CREATE TABLE IF NOT EXISTS " + ReactDatabaseSupplier . TABLE_CATALYST + " (" +
40
40
ReactDatabaseSupplier . KEY_COLUMN + " TEXT PRIMARY KEY, " +
@@ -75,17 +75,18 @@ export default class ReactDatabaseSupplier {
75
75
76
76
async ensureDatabase ( context : common . UIAbilityContext ) : Promise < boolean > {
77
77
if ( this . rdbStore !== null ) return true ;
78
- for ( let tries = 0 ; tries < 2 ; tries ++ ) {
79
- try {
80
- if ( tries > 0 ) await this . deleteRdbStore ( context ) ;
81
- await this . initialRdbStore ( context ) ;
82
- } catch ( e ) {
83
- throw new Error ( `Ensure database faile!` ) ;
84
- }
85
- try {
86
- await this . sleep ( this . SLEEP_TIME_MS )
87
- } catch ( e ) {
88
- throw new Error ( 'Ensure database sleep fail' )
78
+ for ( let tries = 0 ; tries < 3 ; tries ++ ) {
79
+ if ( this . rdbStore === null ) {
80
+ try {
81
+ await this . initialRdbStore ( context ) ;
82
+ } catch ( e ) {
83
+ throw new Error ( `Ensure database faile!` ) ;
84
+ }
85
+ try {
86
+ await this . sleep ( this . SLEEP_TIME_MS )
87
+ } catch ( e ) {
88
+ throw new Error ( 'Ensure database sleep fail' )
89
+ }
89
90
}
90
91
}
91
92
if ( this . rdbStore === null ) {
0 commit comments