Skip to content

Commit 91745fb

Browse files
committed
Fix alarm re-setting
1 parent b03f3c9 commit 91745fb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cpp/src/cpp/types/node.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ namespace hgraph
535535
if (!tag.has_value()) { throw std::runtime_error("Can't schedule an alarm without a tag"); }
536536
auto tag_{tag.value()};
537537
std::string alarm_tag = fmt::format("{}:{}", reinterpret_cast<std::uintptr_t>(this), tag_);
538+
if (_alarm_tags.contains(alarm_tag)) { clock->cancel_alarm(alarm_tag); }
538539
clock->set_alarm(when, alarm_tag, [this, tag_](engine_time_t et) { _on_alarm(et, tag_); });
539540
_alarm_tags[alarm_tag] = when;
540541
return;
@@ -899,4 +900,4 @@ namespace hgraph
899900
graph()->schedule_node(node_ndx(), _scheduler->next_scheduled_time());
900901
}
901902
}
902-
} // namespace hgraph
903+
} // namespace hgraph

0 commit comments

Comments
 (0)