mirror of
https://github.com/mattermost/mattermost.git
synced 2026-02-18 18:18:23 -05:00
Fix /share-channel slash command failing on non-leader HA nodes (#35292)
The Active() check was incorrectly preventing the slash command from working on non-leader nodes in HA clusters. Active() only returns true on the cluster leader (which runs the sync loop), but slash commands can be routed to any node via the load balancer. A nil check is sufficient to verify the service is licensed and configured.
This commit is contained in:
parent
f3d73defcf
commit
944c345687
1 changed files with 5 additions and 4 deletions
|
|
@ -127,13 +127,14 @@ func (sp *ShareProvider) DoCommand(a *app.App, rctx request.CTX, args *model.Com
|
|||
return response(args.T("api.command_share.permission_required", map[string]any{"Permission": "manage_shared_channels"}))
|
||||
}
|
||||
|
||||
syncService := a.Srv().GetSharedChannelSyncService()
|
||||
if syncService == nil || !syncService.Active() {
|
||||
// Only check that the services are non-nil (licensed and configured). Do not check Active()
|
||||
// here because Active() only returns true on the cluster leader node. In HA deployments,
|
||||
// slash commands can be routed to any node via the load balancer, not just the leader.
|
||||
if a.Srv().GetSharedChannelSyncService() == nil {
|
||||
return response(args.T("api.command_share.service_disabled"))
|
||||
}
|
||||
|
||||
rcService := a.Srv().GetRemoteClusterService()
|
||||
if rcService == nil || !rcService.Active() {
|
||||
if a.Srv().GetRemoteClusterService() == nil {
|
||||
return response(args.T("api.command_remote.service_disabled"))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue