File tree 1 file changed +7
-2
lines changed
apps/api/src/shared/torrent
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -496,7 +496,7 @@ export class TorrentService {
496
496
timeRemaining : null ,
497
497
speed : null ,
498
498
numPeers : null
499
- } )
499
+ } , true )
500
500
501
501
await this . updateOne ( item , {
502
502
download : {
@@ -521,8 +521,9 @@ export class TorrentService {
521
521
*
522
522
* @param item
523
523
* @param update
524
+ * @param retryIfError
524
525
*/
525
- public async updateOne ( item : Model < Download | Movie | Episode > , update ) : Promise < Download | Movie | Episode > {
526
+ public async updateOne ( item : Model < Download | Movie | Episode > , update , retryIfError = false ) : Promise < Download | Movie | Episode > {
526
527
// Apply the update
527
528
if ( Object . keys ( update ) . length === 1 && update . download ) {
528
529
this . logger . debug ( `[${ item . _id } ]: Update download info to "${ JSON . stringify ( update . download ) } "` )
@@ -543,6 +544,10 @@ export class TorrentService {
543
544
return await item . save ( )
544
545
545
546
} catch ( e ) {
547
+ if ( retryIfError ) {
548
+ return this . updateOne ( item , update )
549
+ }
550
+
546
551
this . logger . error ( `[${ item . _id } ]: ${ e . message || e } ` )
547
552
548
553
return item
You can’t perform that action at this time.
0 commit comments