running some code on only one cluster node


I'm working on a script that aggregates data into a &synchronized and
&mergeable table, then processes that table on a regular interval. The
code to process that table only needs to be run on one node. What's the
best way to do that?

Would something like this work?

@if (Cluster::local_node_type() in {Cluster::MANAGER, Cluster::NONE})
<code for only one node>

Or should I do something more like this?

const table_processor = "" &redef;
@if (!Cluster::is_enabled() || Cluster::node == table_processor)
<code for only one node>

I tend toward this style.