@@ -9,25 +9,23 @@ const {Worker , workerData } = require("worker_threads")
9
9
const core = require ( "@actions/core" )
10
10
11
11
12
+ const { SolutionDetails} = require ( `${ path . join ( __dirname , 'SolutionDetails.js' ) } ` )
13
+ const worker = new Worker ( `${ path . join ( __dirname , 'worker.js' ) } ` )
14
+
12
15
const INTERVAL = 3000 ;
13
16
14
17
const URL = "https://leetcode.com/api/submissions/"
15
- const PROBLEM_URL = "https://leetcode.com/api/problems/all"
16
18
17
- const all_problems = require ( "./problemstat .json" ) ;
19
+ const all_problems = require ( ` ${ path . join ( __dirname , 'copy .json' ) } ` ) ;
18
20
19
21
const cookieVal = core . getInput ( 'cookieVal' )
20
22
const SOLUTION_LOCATION = core . getInput ( 'solution_location' )
21
23
22
-
23
24
if ( cookieVal === null || cookieVal === undefined || cookieVal . length === 0 )
24
25
{
25
26
throw 'Set COOKIE_SECRET in repo secrets'
26
27
}
27
28
28
-
29
- const { SolutionDetails} = require ( "./SolutionDetails.js" )
30
-
31
29
const readFileDir = util . promisify ( fs . readdir )
32
30
33
31
let aldyPresentSol = { }
@@ -57,7 +55,6 @@ SolutionDetails.prototype.IsPresent = function(){
57
55
}
58
56
}
59
57
60
- const worker = new Worker ( './worker.js' )
61
58
62
59
worker . on ( 'message' , ( ) => {
63
60
console . log ( "done writing" )
@@ -76,13 +73,13 @@ worker.on('exit', ()=>{
76
73
} )
77
74
78
75
let 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
+ } )
86
83
. then ( async ( res ) => {
87
84
worker . postMessage ( { workerData : res . data } )
88
85
resolve ( )
@@ -146,7 +143,6 @@ const FileWriteHdl = async bVal => {
146
143
const sol_obj = new SolutionDetails ( bVal [ i ] ) ;
147
144
if ( ! sol_obj . IsPresent ( ) )
148
145
{
149
- console . log ( "running" )
150
146
await sol_obj . fmtHdl ( )
151
147
aldyPresentSol [ this . id ] = 1 ;
152
148
}
0 commit comments