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

Followed the sample and getting Error about PORT in use #3

Open
tgmerritt opened this issue Oct 3, 2021 · 0 comments
Open

Followed the sample and getting Error about PORT in use #3

tgmerritt opened this issue Oct 3, 2021 · 0 comments

Comments

@tgmerritt
Copy link

Continually getting this port conflict error:

Error: listen EADDRINUSE: address already in use :::55475

Using this basic code to start:


 const throng = require('throng')
 const WORKERS = process.env.WEB_CONCURRENCY || 5

...

function startProdApp() {
  var app = require('../app');
  let port = process.env.PORT;
  function onListen() {
    console.log('Listening on', port)
  }
  app.listen(port, onListen)
}

if(process.env.NODE_ENV === 'development'){
  startApp()
} else {
  throng({
       master: startProdApp(),
       worker: startProdApp(),
       count: WORKERS,
       lifetime: Infinity
   })
}

Heroku won't fork it appears - throng requires declaring the master and worker functions now https://github.com/hunterloftis/throng/blob/master/examples/complex.js

  if (typeof worker !== 'function') {
    throw new Error('Start function required');
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant