Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing zombie thread with multiple instances nightmare #1606

Open
Communism1 opened this issue Jul 6, 2020 · 0 comments
Open

Facing zombie thread with multiple instances nightmare #1606

Communism1 opened this issue Jul 6, 2020 · 0 comments

Comments

@Communism1
Copy link

Communism1 commented Jul 6, 2020

  • Hi everyone, i'm facing with issue that my nightmare project is keeping electron threads everytime cronjob call. Currently, i workaround by kill threads that exist more than 2 min. My question is that there is anyway to fix it ??
        var nightmare2 = new Nightmare({
        })
          nightmare2 
            .goto(url)
            .wait(3000)
            .wait('body')
            .evaluate(() => document.querySelector('body').innerHTML)
            .end()
            .then(response => {
              console.log(get_body(response));
            }).catch(err => {
              fs.unlinkSync('./lock.txt');
              console.log('Lock file deleted')
              console.log(err);
          });
          let get_body = body_content => {
              crawled_object = crawl_preview(pledge_money, backers, total_money, body_content);
          }

        var nightmare3 = new Nightmare({
          })
          nightmare3
            .goto(login_url)
            .type("input[name='user_session[email]']", '')
            .wait(100)
            .type("input[name='user_session[email]']", login_payload.user_session_email)
            .wait(100)
            .type("input[name='user_session[password]']", '')
            .wait(100)
            .type("input[name='user_session[password]']", login_payload.user_session_password)
            .wait(100)
            .click("input[type='submit']")
            .wait(2000)
            .goto(edit_url)
            .wait(4000)
            .wait('body')
              .evaluate(() => document.querySelector('body').innerHTML)
            .then(response => {
              console.log(get_pledge_body(response));
            }).catch(err => {
              fs.unlinkSync('./lock.txt');
              console.log('Lock file deleted')
              console.log(err);
            });

            let get_pledge_body = body_content => {
              var $ = cheerio.load(body_content);
              //get number of rewards in project


              reward_length = $("div[id='app'] > div:nth-child(n+3) > div:nth-child(n+1) > div:nth-child(n+2) \
                                          > div:nth-child(n+1) > div > div").length - 4;

              console.log("reward_length before change " + reward_length);
              console.log(crawled_object)
              console.log(name)
              console.log("Change list is: ")
              console.log(change_list)

              change_pledge(crawled_object, reward_length);
            }

Here my RAM usage and threads:
Screenshot from 2020-07-06 09-51-18

Screenshot from 2020-07-06 09-56-38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant