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

max_memory_restart in StartOptions should be string, not number #3883

Closed
cfi2017 opened this issue Aug 28, 2018 · 3 comments
Closed

max_memory_restart in StartOptions should be string, not number #3883

cfi2017 opened this issue Aug 28, 2018 · 3 comments

Comments

@cfi2017
Copy link

cfi2017 commented Aug 28, 2018

What's going wrong?

The interface StartOptions defines max_memory_restart to be a number. This causes transpiling to fail when trying to set the value to something like '200M' or '2G'.

max_memory_restart?: number;

How could we reproduce this issue?

Try using the pm2 api with TypeScript and starting a process.

Supporting information

Additionally, it does not seem like autorestart is defined as a value of StartOptions.

pm2 report output:

===============================================================================
--- PM2 REPORT (Tue Aug 28 2018 15:18:49 GMT+0200 (Central European Summer Time)) 
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 3.0.3
node version         : 10.8.0
node path            : /Users/cfi/.nvm/versions/node/v10.8.0/bin/pm2
argv                 : /Users/cfi/.nvm/versions/node/v10.8.0/bin/node,/Users/cfi/.nvm/versions/node/v10.8.0/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : cfi
uid                  : 501
gid                  : 20
uptime               : 18881min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 3.0.3
node version         : 10.8.0
node path            : /Users/cfi/.nvm/versions/node/v10.8.0/bin/pm2
argv                 : /Users/cfi/.nvm/versions/node/v10.8.0/bin/node,/Users/cfi/.nvm/versions/node/v10.8.0/bin/pm2,report
argv0                : node
user                 : cfi
uid                  : 501
gid                  : 20
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : darwin
type                 : Darwin
cpus                 : Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
cpus nb              : 12
freemem              : 437809152
totalmem             : 17179869184
home                 : /Users/cfi
===============================================================================
@cfi2017
Copy link
Author

cfi2017 commented Aug 28, 2018

After reading through the source, it seems to default to bytes, so I'm using those for now.

Additionally, it seems wait_ready is not currently supported either.

@wallet77
Copy link
Contributor

Hi @cfi2017

What do you mean by wait_ready is not supported ?
Not defined as a type or not available with API ?

@cfi2017
Copy link
Author

cfi2017 commented Aug 28, 2018

It doesn't look like it's defined as a type. It seems to work if I create a startOptions object like this:

const startOptions: StartOptions = {} as StartOptions;

and then add wait_ready like this:

startOptions['wait_ready'] = true;

Additionally, it seems I can add max_memory_restart as a number (4294967296), but it doesn't seem to affect the actual configuration.

My full configuration and launching script is as follows: (In this example, max_memory_restart has no effect.)

const startOptions: StartOptions = {
  script: 'target/index.js',
  name: 'Worker#' + workerNumber,
  kill_timeout: 30000,
  watch: true,
  max_memory_restart: 4294967296,
  autorestart: false,
  env: {
    NODE_ENV: 'development'
  },
  args: [output, '--deleteOutput=' + options.deleteOutput, '--selfLaunched']
} as StartOptions;

startOptions['wait_ready'] = true;

pm2.start(startOptions, (err2, apps) => {
  // Post-initialization code
});

wallet77 added a commit that referenced this issue Aug 30, 2018
fix: #3883 fix typings for max_memory_restart and add wait_ready
@Unitech Unitech closed this as completed in b35ea23 Sep 7, 2018
inerc pushed a commit to inerc/pm2 that referenced this issue Feb 11, 2020
fix: Unitech#3883 fix typings for max_memory_restart and add wait_ready
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants