File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { lightBlock } from "@/utils/lightBlock";
8
8
import { LightBlock } from "@/models/lightstreamer" ;
9
9
import { logger } from "@/utils/logger" ;
10
10
import { RpcRequestError } from "@ironfish/sdk" ;
11
+ import { wait } from "@/utils/wait" ;
11
12
12
13
function getCachePath ( ) : string {
13
14
if ( process . env [ "CACHE_PATH" ] && process . env [ "CACHE_FOLDER" ] ) {
@@ -58,6 +59,7 @@ export class LightBlockCache {
58
59
logger . warn ( "Rolling head back to rebuild cache." ) ;
59
60
await this . rollbackHead ( ) ;
60
61
}
62
+ wait ( 10000 ) ;
61
63
}
62
64
}
63
65
}
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import zlib from "zlib";
10
10
import { LightBlockCache , lightBlockCache } from "@/cache" ;
11
11
import { LightBlock } from "@/models/lightstreamer" ;
12
12
import { logger } from "@/utils/logger" ;
13
+ import { wait } from "@/utils/wait" ;
13
14
14
15
class UploadError extends Error { }
15
16
@@ -87,6 +88,7 @@ export class LightBlockUpload {
87
88
await this . uploadInner ( ) ;
88
89
} catch ( error ) {
89
90
logger . error ( `Upload failed, will retry. Error: ${ error } ` ) ;
91
+ wait ( 10000 ) ;
90
92
}
91
93
}
92
94
}
@@ -179,7 +181,7 @@ export class LightBlockUpload {
179
181
`hours since last upload: ${ hoursSinceLastUpload . toFixed ( 2 ) } /` +
180
182
`${ this . maxUploadLagMs / ( 1000 * 60 * 60 ) } , waiting...` ,
181
183
) ;
182
- await this . wait ( ) ;
184
+ await wait ( ) ;
183
185
continue ;
184
186
}
185
187
@@ -272,10 +274,6 @@ export class LightBlockUpload {
272
274
return ( bytes / 1024 / 1024 ) . toFixed ( 4 ) ;
273
275
}
274
276
275
- private async wait ( ms = 60000 ) : Promise < void > {
276
- await new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
277
- }
278
-
279
277
async uploadFile (
280
278
prefix : string ,
281
279
fileName : string ,
Original file line number Diff line number Diff line change
1
+ export async function wait ( ms = 60000 ) : Promise < void > {
2
+ await new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
3
+ }
You can’t perform that action at this time.
0 commit comments