diff --git a/source/extensions/common/wasm/context.cc b/source/extensions/common/wasm/context.cc index e4e038682c75..b92bc5146cde 100644 --- a/source/extensions/common/wasm/context.cc +++ b/source/extensions/common/wasm/context.cc @@ -157,8 +157,8 @@ void Context::initializeRoot(WasmBase* wasm, std::shared_ptr plugin) root_local_info_ = &std::static_pointer_cast(plugin)->local_info_; } -WasmResult Context::setTickPeriod(std::chrono::milliseconds tick_period) { - wasm()->setTickPeriod(root_context_id_ ? root_context_id_ : id_, tick_period); +WasmResult Context::setTimerPeriod(std::chrono::milliseconds tick_period, uint32_t*) { + wasm()->setTimerPeriod(root_context_id_ ? root_context_id_ : id_, tick_period); return WasmResult::Ok; } diff --git a/source/extensions/common/wasm/context.h b/source/extensions/common/wasm/context.h index 9d6e6909cafc..802394c09642 100644 --- a/source/extensions/common/wasm/context.h +++ b/source/extensions/common/wasm/context.h @@ -192,6 +192,7 @@ class Context : public proxy_wasm::ContextBase, // General WasmResult log(uint32_t level, absl::string_view message) override; + WasmResult setTimerPeriod(std::chrono::milliseconds tick_period, uint32_t* token) override; uint64_t getCurrentTimeNanoseconds() override; std::pair getStatus() override; @@ -295,7 +296,6 @@ class Context : public proxy_wasm::ContextBase, void onCloseTCP(); virtual absl::string_view getConfiguration(); - virtual WasmResult setTickPeriod(std::chrono::milliseconds tick_period); virtual void clearRouteCache() { if (decoder_callbacks_) { decoder_callbacks_->clearRouteCache(); diff --git a/source/extensions/common/wasm/wasm.cc b/source/extensions/common/wasm/wasm.cc index 29782805c19d..81bd18cc1a20 100644 --- a/source/extensions/common/wasm/wasm.cc +++ b/source/extensions/common/wasm/wasm.cc @@ -117,7 +117,7 @@ Wasm::Wasm(WasmHandleSharedPtr base_wasm_handle, Event::Dispatcher& dispatcher) ENVOY_LOG(debug, "Thread-Local Wasm created {} now active", active_wasms); } -void Wasm::setTickPeriod(uint32_t context_id, std::chrono::milliseconds new_tick_period) { +void Wasm::setTimerPeriod(uint32_t context_id, std::chrono::milliseconds new_tick_period) { auto& tick_period = tick_period_[context_id]; auto& timer = timer_[context_id]; bool was_running = timer && tick_period.count() > 0; diff --git a/source/extensions/common/wasm/wasm.h b/source/extensions/common/wasm/wasm.h index ac376a90d0e8..caf04d97235f 100644 --- a/source/extensions/common/wasm/wasm.h +++ b/source/extensions/common/wasm/wasm.h @@ -58,7 +58,7 @@ class Wasm : public WasmBase, Logger::Loggable { Context* getRootContext(absl::string_view root_id) { return static_cast(WasmBase::getRootContext(root_id)); } - void setTickPeriod(uint32_t root_context_id, std::chrono::milliseconds tick_period) override; + void setTimerPeriod(uint32_t root_context_id, std::chrono::milliseconds tick_period); virtual void tickHandler(uint32_t root_context_id); // WasmBase diff --git a/test/extensions/wasm/wasm_test.cc b/test/extensions/wasm/wasm_test.cc index 0c550b1057cc..010153bdd1e3 100644 --- a/test/extensions/wasm/wasm_test.cc +++ b/test/extensions/wasm/wasm_test.cc @@ -30,7 +30,6 @@ class TestContext : public Extensions::Common::Wasm::Context { return proxy_wasm::WasmResult::Ok; } MOCK_METHOD2(log_, void(spdlog::level::level_enum level, absl::string_view message)); - MOCK_METHOD1(setTickPeriodMilliseconds, void(uint32_t tick_period_milliseconds)); }; class WasmTestBase {