diff --git a/.github/workflows/ci-pr-validation.yml b/.github/workflows/ci-pr-validation.yml index eb109685..e4544b13 100644 --- a/.github/workflows/ci-pr-validation.yml +++ b/.github/workflows/ci-pr-validation.yml @@ -139,7 +139,13 @@ jobs: - name: Package Node binaries lib run: | npx node-pre-gyp package --target_arch=${{ matrix.arch }} - + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: macos-${{matrix.nodejs}}-${{matrix.arch}} + path: build/stage/*/*.tar.gz + linux-napi: name: Build NAPI ${{matrix.image}} - Node ${{matrix.nodejs}} - ${{matrix.cpu.platform}} runs-on: ubuntu-22.04 diff --git a/pkg/mac/build-cpp-deps-lib.sh b/pkg/mac/build-cpp-deps-lib.sh index e2078d12..5e73f02b 100755 --- a/pkg/mac/build-cpp-deps-lib.sh +++ b/pkg/mac/build-cpp-deps-lib.sh @@ -105,10 +105,11 @@ if [ ! -f protobuf-${PROTOBUF_VERSION}.done ]; then curl -O -L https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-cpp-${PROTOBUF_VERSION}.tar.gz tar xfz protobuf-cpp-${PROTOBUF_VERSION}.tar.gz pushd protobuf-${PROTOBUF_VERSION} - CXXFLAGS="-fPIC -arch arm64 -arch x86_64 -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" \ - ./configure --prefix=$PREFIX - make -j16 V=1 - make install + pushd cmake/ + cmake -B build -DCMAKE_CXX_FLAGS="-fPIC -arch arm64 -arch x86_64 -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" \ + -DCMAKE_INSTALL_PREFIX=$PREFIX + cmake --build build -j16 --target install + popd popd pushd install/lib diff --git a/pulsar-client-cpp.txt b/pulsar-client-cpp.txt index 5bb7214e..44b278ca 100644 --- a/pulsar-client-cpp.txt +++ b/pulsar-client-cpp.txt @@ -1,2 +1,2 @@ -CPP_CLIENT_BASE_URL=https://archive.apache.org/dist/pulsar/pulsar-client-cpp-3.2.0 -CPP_CLIENT_VERSION=3.2.0 +CPP_CLIENT_BASE_URL=https://dist.apache.org/repos/dist/dev/pulsar/pulsar-client-cpp/pulsar-client-cpp-3.4.1-candidate-1/ +CPP_CLIENT_VERSION=3.4.1 diff --git a/src/Producer.cc b/src/Producer.cc index c827f9f8..b7647c0b 100644 --- a/src/Producer.cc +++ b/src/Producer.cc @@ -138,7 +138,12 @@ Napi::Value Producer::Flush(const Napi::CallbackInfo &info) { [](pulsar_result result, void *ctx) { auto deferredContext = static_cast(ctx); auto deferred = deferredContext->deferred; - delete deferredContext; + + deferredContext->callnum++; + if (deferredContext ->callnum == 2) { + delete deferredContext; + return; + } if (result != pulsar_result_Ok) { deferred->Reject(std::string("Failed to flush producer: ") + pulsar_result_str(result)); diff --git a/src/ThreadSafeDeferred.h b/src/ThreadSafeDeferred.h index da050f99..a866ed06 100644 --- a/src/ThreadSafeDeferred.h +++ b/src/ThreadSafeDeferred.h @@ -80,6 +80,7 @@ class ThreadSafeDeferred : public Napi::Promise::Deferred { struct ExtDeferredContext { ExtDeferredContext(std::shared_ptr deferred) : deferred(deferred){}; std::shared_ptr deferred; + int callnum = 0; }; #endif /* __THREADSAFE_DEFERRED_HPP */