From e82a585cec48fa7a16e4edcccb1ef9021e27d2ca Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Thu, 19 Mar 2020 21:21:21 +0000 Subject: [PATCH] Ensure AsyncWorker options are persisted #2130 --- docs/changelog.md | 3 +++ src/metadata.cc | 1 + src/pipeline.cc | 1 + src/stats.cc | 1 + 4 files changed, 6 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 65b7f3d2..1ca3c681 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -18,6 +18,9 @@ Requires libvips v8.9.1 * Ensure N-API prebuilt binaries work on RHEL7 and its derivatives. [#2119](https://github.com/lovell/sharp/issues/2119) +* Ensure AsyncWorker options are persisted. + [#2130](https://github.com/lovell/sharp/issues/2130) + ### v0.25.1 - 7th March 2020 * Ensure prebuilt binaries are fetched based on N-API version. diff --git a/src/metadata.cc b/src/metadata.cc index f7076252..25c2871c 100644 --- a/src/metadata.cc +++ b/src/metadata.cc @@ -229,6 +229,7 @@ Napi::Value metadata(const Napi::CallbackInfo& info) { // Join queue for worker thread Napi::Function callback = info[1].As(); MetadataWorker *worker = new MetadataWorker(callback, baton, debuglog); + worker->Receiver().Set("options", options); worker->Queue(); // Increment queued task counter diff --git a/src/pipeline.cc b/src/pipeline.cc index 6a05be64..9faceb46 100644 --- a/src/pipeline.cc +++ b/src/pipeline.cc @@ -1360,6 +1360,7 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) { // Join queue for worker thread Napi::Function callback = info[1].As(); PipelineWorker *worker = new PipelineWorker(callback, baton, debuglog, queueListener); + worker->Receiver().Set("options", options); worker->Queue(); // Increment queued task counter diff --git a/src/stats.cc b/src/stats.cc index 16cc1539..45fd9a59 100644 --- a/src/stats.cc +++ b/src/stats.cc @@ -154,6 +154,7 @@ Napi::Value stats(const Napi::CallbackInfo& info) { // Join queue for worker thread Napi::Function callback = info[1].As(); StatsWorker *worker = new StatsWorker(callback, baton, debuglog); + worker->Receiver().Set("options", options); worker->Queue(); // Increment queued task counter