Skip to content

Commit 829bce3

Browse files
authored
impl(bigtable): cancel refresh_timer_ in QueryPlan destructor (#15755)
1 parent c7f8877 commit 829bce3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

google/cloud/bigtable/internal/query_plan.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ std::shared_ptr<QueryPlan> QueryPlan::Create(
3535
return plan;
3636
}
3737

38+
QueryPlan::~QueryPlan() {
39+
if (refresh_timer_.valid()) refresh_timer_.cancel();
40+
}
41+
3842
void QueryPlan::Initialize() {
3943
std::unique_lock<std::mutex> lock(mu_);
4044
if (state_ == RefreshState::kDone) ScheduleRefresh(lock);

google/cloud/bigtable/internal/query_plan.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class QueryPlan : public std::enable_shared_from_this<QueryPlan> {
4343
StatusOr<google::bigtable::v2::PrepareQueryResponse> response,
4444
RefreshFn fn, std::shared_ptr<Clock> clock = std::make_shared<Clock>());
4545

46+
~QueryPlan();
47+
4648
// Invalidates the current QueryPlan and triggers a refresh.
4749
void Invalidate(Status status, std::string const& invalid_query_plan_id);
4850

0 commit comments

Comments
 (0)