@@ -9,25 +9,23 @@ const {Worker , workerData } = require("worker_threads")
99const core = require ( "@actions/core" )
1010
1111
12+ const { SolutionDetails} = require ( `${ path . join ( __dirname , 'SolutionDetails.js' ) } ` )
13+ const worker = new Worker ( `${ path . join ( __dirname , 'worker.js' ) } ` )
14+
1215const INTERVAL = 3000 ;
1316
1417const URL = "https://leetcode.com/api/submissions/"
15- const PROBLEM_URL = "https://leetcode.com/api/problems/all"
1618
17- const all_problems = require ( "./problemstat .json" ) ;
19+ const all_problems = require ( ` ${ path . join ( __dirname , 'copy .json' ) } ` ) ;
1820
1921const cookieVal = core . getInput ( 'cookieVal' )
2022const SOLUTION_LOCATION = core . getInput ( 'solution_location' )
2123
22-
2324if ( cookieVal === null || cookieVal === undefined || cookieVal . length === 0 )
2425{
2526 throw 'Set COOKIE_SECRET in repo secrets'
2627}
2728
28-
29- const { SolutionDetails} = require ( "./SolutionDetails.js" )
30-
3129const readFileDir = util . promisify ( fs . readdir )
3230
3331let aldyPresentSol = { }
@@ -57,7 +55,6 @@ SolutionDetails.prototype.IsPresent = function(){
5755 }
5856}
5957
60- const worker = new Worker ( './worker.js' )
6158
6259worker . on ( 'message' , ( ) => {
6360 console . log ( "done writing" )
@@ -76,13 +73,13 @@ worker.on('exit', ()=>{
7673} )
7774
7875let solutionPromise = ( question ) => new Promise ( ( resolve , reject ) => {
79- axios ( {
80- method : 'GET' ,
81- baseURL : `${ URL } ${ question . question__title_slug } ` ,
82- headers : {
83- cookie : cookieVal
84- }
85- } )
76+ axios ( {
77+ method : 'GET' ,
78+ baseURL : `${ URL } ${ question . question__title_slug } ` ,
79+ headers : {
80+ cookie : cookieVal
81+ }
82+ } )
8683 . then ( async ( res ) => {
8784 worker . postMessage ( { workerData : res . data } )
8885 resolve ( )
@@ -146,7 +143,6 @@ const FileWriteHdl = async bVal => {
146143 const sol_obj = new SolutionDetails ( bVal [ i ] ) ;
147144 if ( ! sol_obj . IsPresent ( ) )
148145 {
149- console . log ( "running" )
150146 await sol_obj . fmtHdl ( )
151147 aldyPresentSol [ this . id ] = 1 ;
152148 }
0 commit comments