Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6366895

Browse files
authoredDec 12, 2024··
Node v23 (#158)
* Update nan version for Node 23 and remove deprecated type * Update semaphore pipeline to use matrix and add node 23 * Update package with dummy new version to force builds * Update C++ minimum requirement * Replace persistent function with Nan::Callback* * Add gcc/g++ update in semaphore * Update gcc version in non-tag tasks * Revert package.json changes after testing * Address comment and update agents to 22.04 * Change package.json for testing builds through dev tag * Revert changes for 0.5.2-dev tag testing * Assume yes for adding repo to make performance test run * Make debian frontend noninteractive to prevent install from getting stuck * Update CHANGELOG and README
1 parent 7ec8cda commit 6366895

File tree

8 files changed

+1018
-2004
lines changed

8 files changed

+1018
-2004
lines changed
 

‎.semaphore/semaphore.yml

Lines changed: 108 additions & 232 deletions
Large diffs are not rendered by default.

‎CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ v1.0.0 is a feature release. It is supported for all usage.
55
## Enhancements
66

77
1. Add support for an Admin API to fetch topic offsets (#156).
8+
2. Add support for Node v23 pre-built binaries (#158).
89

910
## Fixes
1011

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ To use **Schema Registry**, use the existing [@confluentinc/schemaregistry](http
3232

3333
The following configurations are supported:
3434

35-
* Any supported version of Node.js (The two LTS versions, 18 and 20, and the latest versions, 21 and 22).
35+
* Any supported version of Node.js (The two LTS versions, 18 and 20, and the latest versions, 21, 22 and 23).
3636
* Linux (x64 and arm64) - both glibc and musl/alpine.
3737
* macOS - arm64/m1. macOS (Intel) is supported on a best-effort basis.
3838
* Windows - x64.

‎binding.gyp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
}
4545
],
4646
'cflags_cc' : [
47-
'-std=c++17'
47+
'-std=c++20'
4848
],
4949
'msvs_settings': {
5050
'VCLinkerTool': {
@@ -135,7 +135,7 @@
135135
'OS=="linux"',
136136
{
137137
'cflags_cc' : [
138-
'-std=c++17'
138+
'-std=c++20'
139139
],
140140
'cflags_cc!': [
141141
'-fno-rtti'
@@ -153,7 +153,7 @@
153153
],
154154
'OTHER_CPLUSPLUSFLAGS': [
155155
'-I/usr/local/opt/openssl/include',
156-
'-std=c++17'
156+
'-std=c++20'
157157
],
158158
},
159159
}

‎package-lock.json

Lines changed: 897 additions & 1753 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"dependencies": {
5555
"@mapbox/node-pre-gyp": "^1.0.11",
5656
"bindings": "^1.3.1",
57-
"nan": "^2.17.0"
57+
"nan": "^2.22.0"
5858
},
5959
"engines": {
6060
"node": ">=18.0.0"

‎src/callbacks.cc

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Dispatcher::~Dispatcher() {
6060
if (callbacks.size() < 1) return;
6161

6262
for (size_t i=0; i < callbacks.size(); i++) {
63-
callbacks[i].Reset();
63+
delete callbacks[i];
6464
}
6565

6666
uv_mutex_destroy(&async_lock);
@@ -107,24 +107,21 @@ void Dispatcher::Dispatch(const int _argc, Local<Value> _argv[]) {
107107
}
108108

109109
for (size_t i=0; i < callbacks.size(); i++) {
110-
v8::Local<v8::Function> f = Nan::New<v8::Function>(callbacks[i]);
111-
Nan::Callback cb(f);
112-
cb.Call(_argc, _argv);
110+
callbacks[i]->Call(_argc, _argv);
113111
}
114112
}
115113

116114
void Dispatcher::AddCallback(const v8::Local<v8::Function> &cb) {
117-
Nan::Persistent<v8::Function,
118-
Nan::CopyablePersistentTraits<v8::Function> > value(cb);
119-
// PersistentCopyableFunction value(func);
115+
Nan::Callback *value = new Nan::Callback(cb);
120116
callbacks.push_back(value);
121117
}
122118

123119
void Dispatcher::RemoveCallback(const v8::Local<v8::Function> &cb) {
124120
for (size_t i=0; i < callbacks.size(); i++) {
125-
if (callbacks[i] == cb) {
126-
callbacks[i].Reset();
121+
if (callbacks[i]->GetFunction() == cb) {
122+
Nan::Callback *found_callback = callbacks[i];
127123
callbacks.erase(callbacks.begin() + i);
124+
delete found_callback;
128125
break;
129126
}
130127
}

‎src/callbacks.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
#include "rdkafkacpp.h" // NOLINT
2020
#include "src/common.h"
2121

22-
typedef Nan::Persistent<v8::Function,
23-
Nan::CopyablePersistentTraits<v8::Function> > PersistentCopyableFunction;
24-
typedef std::vector<PersistentCopyableFunction> CopyableFunctionList;
25-
2622
namespace NodeKafka {
2723

2824
class KafkaConsumer;
@@ -43,7 +39,7 @@ class Dispatcher {
4339
void Deactivate();
4440

4541
protected:
46-
std::vector<v8::Persistent<v8::Function, v8::CopyablePersistentTraits<v8::Function> > > callbacks; // NOLINT
42+
std::vector<Nan::Callback*> callbacks; // NOLINT
4743

4844
uv_mutex_t async_lock;
4945

0 commit comments

Comments
 (0)
Please sign in to comment.