Add RunOnSingleNode helper method to the Plugin API. Method should run passed function on a single node in a HA environment.
func (p *HelpersImpl) RunOnSingleNode(id string, f func()) error
Assume that method RunOnSingleNode will run on many nodes. f()
function should run on a single node only. To clarify, whenever we run RunOnSingleNode(id, f)
, f()
function should run only on a single node and only once. If we run RunOnSingleNode(id, f)
with the same id
second time f()
should not run. If we run RunOnSingleNode(id2, f)
with different id
the function f()
should run again, on a single node(might be different node though).
This method is inspired by the sync.Once.Do
method. https://golang.org/pkg/sync/#Once.Do
Note: KVStore methods can be used as a synchronization mechanism.
If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.
New contributors please see our Developer's Guide.
@iomodo Who can I reach out to concerning this issue to get more clarity in the contributor's channel?
@Lumexralph it's great that you are interested, dm me.
@iomodo Has anyone started working on this?
Sorry @proishan11, @Lumexralph is on it already
@iomodo Seem likes the issue is up for grab. May I working on this?
@pistachiology Sure! Thanks for having an interest!
Closing this issue for now while we pivot on the upcoming plugin API layer rework.
Most helpful comment
@iomodo Seem likes the issue is up for grab. May I working on this?