@@ -27,7 +27,10 @@ const runAndSetInterval = async (fn, time, name, handle = true) => {
2727 logger . error ( `[${ name } ] Job threw an error` , error )
2828 }
2929 logger . info ( `[${ name } ] Job finished, setting timer` )
30- setTimeout ( fn , time * 1000 )
30+
31+ setTimeout ( ( ) => {
32+ runAndSetInterval ( fn , time , name , handle )
33+ } , time * 1000 )
3134}
3235
3336const contentHandler = async ( ) => {
@@ -50,6 +53,8 @@ const contentHandler = async () => {
5053 const size = item . size
5154 const hash = item . hash
5255
56+ logger . info ( `Handling ${ JAVID } , hash ${ hash } ` )
57+
5358 if ( size > 10 ) {
5459 logger . info ( `[${ JAVID } ] File oversize, skipped` )
5560 continue
@@ -101,6 +106,7 @@ const contentHandler = async () => {
101106 } )
102107 }
103108
109+ logger . debug ( `[${ JAVID } ] Parsing torrent info` )
104110 const torrentInfo = parseTorrent ( fs . readFileSync ( torrentFilePath ) )
105111 if ( ! torrentInfo . files ) {
106112 logger . warn ( `[${ JAVID } ] Torrent invalid, skipped` )
@@ -109,6 +115,7 @@ const contentHandler = async () => {
109115
110116 let videoFileCount = 0
111117
118+ logger . debug ( `[${ JAVID } ] Torrent files` , torrentInfo . files )
112119 for ( const index in torrentInfo . files ) {
113120 const fileInfo = torrentInfo . files [ index ]
114121
@@ -122,6 +129,7 @@ const contentHandler = async () => {
122129 continue
123130 }
124131
132+ logger . debug ( `[${ JAVID } ] Adding to qbittorrent` )
125133 await qb . addTorrentLink ( torrentURL )
126134
127135 db . get ( 'processed' ) . push ( {
0 commit comments