Skip to content

Commit 59e16b2

Browse files
committed
added concrete relative location
1 parent 1463823 commit 59e16b2

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.github/src/node_modules
2-
.github/src/copy.json
32
.github/src/.env
43

54
src/.env

src/app.js

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,23 @@ const {Worker , workerData } = require("worker_threads")
99
const 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+
1215
const INTERVAL = 3000;
1316

1417
const 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

1921
const cookieVal = core.getInput('cookieVal')
2022
const SOLUTION_LOCATION = core.getInput('solution_location')
2123

22-
2324
if(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-
3129
const readFileDir = util.promisify(fs.readdir)
3230

3331
let aldyPresentSol = {}
@@ -57,7 +55,6 @@ SolutionDetails.prototype.IsPresent = function(){
5755
}
5856
}
5957

60-
const worker = new Worker('./worker.js' )
6158

6259
worker.on('message', ()=>{
6360
console.log("done writing")
@@ -76,13 +73,13 @@ worker.on('exit', ()=>{
7673
})
7774

7875
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+
})
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
}

src/worker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ parentPort.on('message' , (data) => {
1717

1818
const writeSol = (data) => {
1919
const solutionDetails = data.submissions_dump
20+
console.log(data, "data to write! ")
2021
if (solutionDetails.length > 0 )
2122
{
2223
for(let i = 0 ; i < solutionDetails.length ; i++ )

0 commit comments

Comments
 (0)