Skip to content

Commit d731369

Browse files
committed
async_hooks: remove deprecated APIs
These APIs were introduced during the lifetime of Node 8 in an experimental API and should safely be removable in Node 9+. PR-URL: #14414 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Andreas Madsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 2e7ccc2 commit d731369

File tree

4 files changed

+3
-57
lines changed

4 files changed

+3
-57
lines changed

doc/api/deprecations.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ The DebugContext will be removed in V8 soon and will not be available in Node
607607
<a id="DEP0070"></a>
608608
### DEP0070: async_hooks.currentId()
609609

610-
Type: Runtime
610+
Type: End-of-Life
611611

612612
`async_hooks.currentId()` was renamed to `async_hooks.executionAsyncId()` for
613613
clarity.
@@ -617,7 +617,7 @@ clarity.
617617
<a id="DEP0071"></a>
618618
### DEP0071: async_hooks.triggerId()
619619

620-
Type: Runtime
620+
Type: End-of-Life
621621

622622
`async_hooks.triggerId()` was renamed to `async_hooks.triggerAsyncId()` for
623623
clarity.
@@ -627,7 +627,7 @@ clarity.
627627
<a id="DEP0072"></a>
628628
### DEP0072: async_hooks.AsyncResource.triggerId()
629629

630-
Type: Runtime
630+
Type: End-of-Life
631631

632632
`async_hooks.AsyncResource.triggerId()` was renamed to
633633
`async_hooks.AsyncResource.triggerAsyncId()` for clarity.

lib/async_hooks.js

-32
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22

3-
const internalUtil = require('internal/util');
43
const async_wrap = process.binding('async_wrap');
54
/* Both these arrays are used to communicate between JS and C++ with as little
65
* overhead as possible.
@@ -245,17 +244,6 @@ class AsyncResource {
245244
}
246245

247246

248-
// triggerId was renamed to triggerAsyncId. This was in 8.2.0 during the
249-
// experimental stage so the alias can be removed at any time, we are just
250-
// being nice :)
251-
Object.defineProperty(AsyncResource.prototype, 'triggerId', {
252-
get: internalUtil.deprecate(function() {
253-
return AsyncResource.prototype.triggerAsyncId;
254-
}, 'AsyncResource.triggerId is deprecated. ' +
255-
'Use AsyncResource.triggerAsyncId instead.', 'DEP0072')
256-
});
257-
258-
259247
function runInAsyncIdScope(asyncId, cb) {
260248
// Store the async id now to make sure the stack is still good when the ids
261249
// are popped off the stack.
@@ -462,23 +450,3 @@ module.exports = {
462450
emitAfter: emitAfterScript,
463451
emitDestroy: emitDestroyScript,
464452
};
465-
466-
// currentId was renamed to executionAsyncId. This was in 8.2.0 during the
467-
// experimental stage so the alias can be removed at any time, we are just
468-
// being nice :)
469-
Object.defineProperty(module.exports, 'currentId', {
470-
get: internalUtil.deprecate(function() {
471-
return executionAsyncId;
472-
}, 'async_hooks.currentId is deprecated. ' +
473-
'Use async_hooks.executionAsyncId instead.', 'DEP0070')
474-
});
475-
476-
// triggerId was renamed to triggerAsyncId. This was in 8.2.0 during the
477-
// experimental stage so the alias can be removed at any time, we are just
478-
// being nice :)
479-
Object.defineProperty(module.exports, 'triggerId', {
480-
get: internalUtil.deprecate(function() {
481-
return triggerAsyncId;
482-
}, 'async_hooks.triggerId is deprecated. ' +
483-
'Use async_hooks.triggerAsyncId instead.', 'DEP0071')
484-
});

src/async-wrap.cc

-8
Original file line numberDiff line numberDiff line change
@@ -745,19 +745,11 @@ async_id AsyncHooksGetExecutionAsyncId(Isolate* isolate) {
745745
return Environment::GetCurrent(isolate)->current_async_id();
746746
}
747747

748-
async_id AsyncHooksGetCurrentId(Isolate* isolate) {
749-
return AsyncHooksGetExecutionAsyncId(isolate);
750-
}
751-
752748

753749
async_id AsyncHooksGetTriggerAsyncId(Isolate* isolate) {
754750
return Environment::GetCurrent(isolate)->trigger_id();
755751
}
756752

757-
async_id AsyncHooksGetTriggerId(Isolate* isolate) {
758-
return AsyncHooksGetTriggerAsyncId(isolate);
759-
}
760-
761753

762754
async_context EmitAsyncInit(Isolate* isolate,
763755
Local<Object> resource,

src/node.h

-14
Original file line numberDiff line numberDiff line change
@@ -533,17 +533,9 @@ NODE_EXTERN void AddPromiseHook(v8::Isolate* isolate,
533533
* zero then no execution has been set. This will happen if the user handles
534534
* I/O from native code. */
535535
NODE_EXTERN async_id AsyncHooksGetExecutionAsyncId(v8::Isolate* isolate);
536-
/* legacy alias */
537-
NODE_EXTERN NODE_DEPRECATED("Use AsyncHooksGetExecutionAsyncId(isolate)",
538-
async_id AsyncHooksGetCurrentId(v8::Isolate* isolate));
539-
540536

541537
/* Return same value as async_hooks.triggerAsyncId(); */
542538
NODE_EXTERN async_id AsyncHooksGetTriggerAsyncId(v8::Isolate* isolate);
543-
/* legacy alias */
544-
NODE_EXTERN NODE_DEPRECATED("Use AsyncHooksGetTriggerAsyncId(isolate)",
545-
async_id AsyncHooksGetTriggerId(v8::Isolate* isolate));
546-
547539

548540
/* If the native API doesn't inherit from the helper class then the callbacks
549541
* must be triggered manually. This triggers the init() callback. The return
@@ -643,12 +635,6 @@ class AsyncResource {
643635
return resource_.Get(isolate_);
644636
}
645637

646-
NODE_DEPRECATED("Use AsyncResource::get_async_id()",
647-
async_id get_uid() const {
648-
return get_async_id();
649-
}
650-
)
651-
652638
async_id get_async_id() const {
653639
return async_context_.async_id;
654640
}

0 commit comments

Comments
 (0)