Skip to content

Conversation

@joyeecheung
Copy link
Member

@joyeecheungjoyeecheung commented Feb 19, 2019

process: fix calculation in process.uptime()

In #26016 the result returned
by process.uptime() was mistakenly set to be based in the wrong
unit. This patch fixes the calculation and makes sure the returned
value is in seconds.

Refs: #26016
Fixes: #26205

process: move test-process-uptime to parallel

In addition, do not make too many assumptions about the startup
time and timer latency in test-process-uptime. Instead only test
that the value is likely in the correct unit (seconds) and it should
be increasing in subsequent calls.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Feb 19, 2019
@joyeecheungjoyeecheung changed the title Fix uptimeprocess: fix calculation in process.uptime()Feb 19, 2019
Copy link
Member

@addaleaxaddaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

process: move test-process-uptime to pummel

^ should this read to parallel?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to use common.platformTimeout() at all if all we're checking is original < uptime. For that matter, this can probably use a value more like 5 than 100?

Copy link
Member

@TrottTrott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. (OK by me if my one comment/nit is ignored.)

@joyeecheung
Copy link
MemberAuthor

@addaleax

^ should this read to parallel?

Yes. (This is what happens when I stay up at 2am 🤦‍♀️ )

Updated the test description and the timeout.
CI: https://ci.nodejs.org/job/node-test-pull-request/20886/

@TrottTrott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 19, 2019
In nodejs#26016 the result returned by process.uptime() was mistakenly set to be based in the wrong unit. This patch fixes the calculation and makes sure the returned value is in seconds. Refs: nodejs#26016
In addition, do not make too many assumptions about the startup time and timer latency in test-process-uptime. Instead only test that the value is likely in the correct unit (seconds) and it should be increasing in subsequent calls.
@Trott
Copy link
Member

Tiny lint error: common assigned but never used in the test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
constcommon=require('../common');
require('../common');

@Trott
Copy link
Member

I'd like to fast-track this (to fix the failing test), but it's 3AM in China, so I'm going to push the tiny lint fix and re-run CI.

@Trott
Copy link
Member

@Trott
Copy link
Member

Please 👍 here if you support fast-tracking. @addaleax@richardlau

@TrottTrott added the fast-track PRs that do not need to wait for 48 hours to land. label Feb 19, 2019
@Trott
Copy link
Member

Landed in 129516d...5c9b37b. Thanks, @joyeecheung! 🎉

@TrottTrott closed this Feb 19, 2019
Trott pushed a commit to Trott/io.js that referenced this pull request Feb 19, 2019
In nodejs#26016 the result returned by process.uptime() was mistakenly set to be based in the wrong unit. This patch fixes the calculation and makes sure the returned value is in seconds. Refs: nodejs#26016 PR-URL: nodejs#26206Fixes: nodejs#26205 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]>
Trott pushed a commit to Trott/io.js that referenced this pull request Feb 19, 2019
In addition, do not make too many assumptions about the startup time and timer latency in test-process-uptime. Instead only test that the value is likely in the correct unit (seconds) and it should be increasing in subsequent calls. PR-URL: nodejs#26206Fixes: nodejs#26205 Refs: nodejs#26016 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]>
addaleax pushed a commit that referenced this pull request Feb 21, 2019
In #26016 the result returned by process.uptime() was mistakenly set to be based in the wrong unit. This patch fixes the calculation and makes sure the returned value is in seconds. Refs: #26016 PR-URL: #26206Fixes: #26205 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]>
addaleax pushed a commit that referenced this pull request Feb 21, 2019
In addition, do not make too many assumptions about the startup time and timer latency in test-process-uptime. Instead only test that the value is likely in the correct unit (seconds) and it should be increasing in subsequent calls. PR-URL: #26206Fixes: #26205 Refs: #26016 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]>
@BridgeARBridgeAR mentioned this pull request Feb 26, 2019
rvagg pushed a commit that referenced this pull request Feb 28, 2019
In #26016 the result returned by process.uptime() was mistakenly set to be based in the wrong unit. This patch fixes the calculation and makes sure the returned value is in seconds. Refs: #26016 PR-URL: #26206Fixes: #26205 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]>
rvagg pushed a commit that referenced this pull request Feb 28, 2019
In addition, do not make too many assumptions about the startup time and timer latency in test-process-uptime. Instead only test that the value is likely in the correct unit (seconds) and it should be increasing in subsequent calls. PR-URL: #26206Fixes: #26205 Refs: #26016 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.c++Issues and PRs that require attention from people who are familiar with C++.fast-trackPRs that do not need to wait for 48 hours to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recently-introduced breaking change (unintentional?) in process.uptime()

5 participants

@joyeecheung@nodejs-github-bot@Trott@addaleax@richardlau