diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b7cbb54a..53de9edb 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -27,7 +27,6 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Cache uses: actions/cache@v4 with: diff --git a/src/draft.ts b/src/draft.ts index d67cd808..d0ee38e4 100644 --- a/src/draft.ts +++ b/src/draft.ts @@ -41,27 +41,22 @@ interface RadioGroupOptions { export interface Radio extends Writable {} allowMethods(Radio.prototype, ["send"]) -const join = ( - Socket.prototype as Socket & { - join: (value: Array) => void - } -).join -const leave = ( - Socket.prototype as Socket & { - leave: (value: Array) => void - } -).leave - export class Dish extends Socket { constructor(options?: SocketOptions) { super(SocketType.Dish, options) } join(...values: Array): void { + const {join} = Socket.prototype as Socket & { + join: (value: Array) => void + } join(values) } leave(...values: Array): void { + const {leave} = Socket.prototype as Socket & { + leave: (value: Array) => void + } leave(values) } } diff --git a/src/socket.cc b/src/socket.cc index 43176cb2..95385db2 100644 --- a/src/socket.cc +++ b/src/socket.cc @@ -140,9 +140,12 @@ Socket::Socket(const Napi::CallbackInfo& info) /* Callback to free the underlying poller. Move the poller to transfer ownership after the constructor has completed. */ - finalize = [&]() { - [[maybe_unused]] auto err = zmq_poller_destroy(&poll); - assert(err == 0); + finalize = [poll]() mutable { + if (poll != nullptr) { + [[maybe_unused]] auto err = zmq_poller_destroy(&poll); + assert(err == 0); + poll = nullptr; + } }; if (zmq_poller_add(poll, socket, nullptr, ZMQ_POLLIN | ZMQ_POLLOUT) < 0) {