[MM-57407] Add setting to disable the wake up on reconnect handler (#26924)
* [MM-57407] Add setting to disable the wake up on reconnect handler * Add dependency --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4b5d02990d
Коммит
8da64a5c34
@@ -96,6 +96,7 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li
|
|||||||
props["CWSMock"] = model.MockCWS
|
props["CWSMock"] = model.MockCWS
|
||||||
|
|
||||||
props["DisableRefetchingOnBrowserFocus"] = strconv.FormatBool(*c.ExperimentalSettings.DisableRefetchingOnBrowserFocus)
|
props["DisableRefetchingOnBrowserFocus"] = strconv.FormatBool(*c.ExperimentalSettings.DisableRefetchingOnBrowserFocus)
|
||||||
|
props["DisableWakeUpReconnectHandler"] = strconv.FormatBool(*c.ExperimentalSettings.DisableWakeUpReconnectHandler)
|
||||||
|
|
||||||
// Set default values for all options that require a license.
|
// Set default values for all options that require a license.
|
||||||
props["ExperimentalEnableAuthenticationTransfer"] = "true"
|
props["ExperimentalEnableAuthenticationTransfer"] = "true"
|
||||||
|
|||||||
@@ -1009,6 +1009,7 @@ type ExperimentalSettings struct {
|
|||||||
DisableAppBar *bool `access:"experimental_features"`
|
DisableAppBar *bool `access:"experimental_features"`
|
||||||
DisableRefetchingOnBrowserFocus *bool `access:"experimental_features"`
|
DisableRefetchingOnBrowserFocus *bool `access:"experimental_features"`
|
||||||
DelayChannelAutocomplete *bool `access:"experimental_features"`
|
DelayChannelAutocomplete *bool `access:"experimental_features"`
|
||||||
|
DisableWakeUpReconnectHandler *bool `access:"experimental_features"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ExperimentalSettings) SetDefaults() {
|
func (s *ExperimentalSettings) SetDefaults() {
|
||||||
@@ -1047,6 +1048,10 @@ func (s *ExperimentalSettings) SetDefaults() {
|
|||||||
if s.DelayChannelAutocomplete == nil {
|
if s.DelayChannelAutocomplete == nil {
|
||||||
s.DelayChannelAutocomplete = NewBool(false)
|
s.DelayChannelAutocomplete = NewBool(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.DisableWakeUpReconnectHandler == nil {
|
||||||
|
s.DisableWakeUpReconnectHandler = NewBool(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type AnalyticsSettings struct {
|
type AnalyticsSettings struct {
|
||||||
|
|||||||
@@ -6204,6 +6204,13 @@ const AdminDefinition: AdminDefinitionType = {
|
|||||||
help_text: defineMessage({id: 'admin.experimental.disableRefetchingOnBrowserFocus.desc', defaultMessage: 'When true, Mattermost will not refetch channels and channel members when the browser regains focus. This may result in improved performance for users with many channels and channel members.'}),
|
help_text: defineMessage({id: 'admin.experimental.disableRefetchingOnBrowserFocus.desc', defaultMessage: 'When true, Mattermost will not refetch channels and channel members when the browser regains focus. This may result in improved performance for users with many channels and channel members.'}),
|
||||||
isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.EXPERIMENTAL.FEATURES)),
|
isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.EXPERIMENTAL.FEATURES)),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'bool',
|
||||||
|
key: 'ExperimentalSettings.DisableWakeUpReconnectHandler',
|
||||||
|
label: defineMessage({id: 'admin.experimental.disableWakeUpReconnectHandler.title', defaultMessage: 'Disable Wake Up Reconnect Handler:'}),
|
||||||
|
help_text: defineMessage({id: 'admin.experimental.disableWakeUpReconnectHandler.desc', defaultMessage: 'When true, Mattermost will not attempt to detect when the computer has woken up and refetch data. This might reduce the amount of regular network traffic the app is sending.'}),
|
||||||
|
isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.EXPERIMENTAL.FEATURES)),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: 'bool',
|
type: 'bool',
|
||||||
key: 'ExperimentalSettings.DelayChannelAutocomplete',
|
key: 'ExperimentalSettings.DelayChannelAutocomplete',
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ function mapStateToProps(state: GlobalState, ownProps: OwnProps) {
|
|||||||
const currentUser = getCurrentUser(state);
|
const currentUser = getCurrentUser(state);
|
||||||
const plugins = state.plugins.components.NeedsTeamComponent;
|
const plugins = state.plugins.components.NeedsTeamComponent;
|
||||||
const disableRefetchingOnBrowserFocus = config.DisableRefetchingOnBrowserFocus === 'true';
|
const disableRefetchingOnBrowserFocus = config.DisableRefetchingOnBrowserFocus === 'true';
|
||||||
|
const disableWakeUpReconnectHandler = config.DisableWakeUpReconnectHandler === 'true';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentTeamId: getCurrentTeamId(state),
|
currentTeamId: getCurrentTeamId(state),
|
||||||
@@ -44,6 +45,7 @@ function mapStateToProps(state: GlobalState, ownProps: OwnProps) {
|
|||||||
selectedThreadId: getSelectedThreadIdInCurrentTeam(state),
|
selectedThreadId: getSelectedThreadIdInCurrentTeam(state),
|
||||||
mfaRequired: checkIfMFARequired(currentUser, license, config, ownProps.match.url),
|
mfaRequired: checkIfMFARequired(currentUser, license, config, ownProps.match.url),
|
||||||
disableRefetchingOnBrowserFocus,
|
disableRefetchingOnBrowserFocus,
|
||||||
|
disableWakeUpReconnectHandler,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,10 @@ function TeamController(props: Props) {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (props.disableWakeUpReconnectHandler) {
|
||||||
|
return () => {};
|
||||||
|
}
|
||||||
|
|
||||||
const wakeUpIntervalId = setInterval(() => {
|
const wakeUpIntervalId = setInterval(() => {
|
||||||
const currentTime = Date.now();
|
const currentTime = Date.now();
|
||||||
if ((currentTime - lastTime.current) > WAKEUP_THRESHOLD) {
|
if ((currentTime - lastTime.current) > WAKEUP_THRESHOLD) {
|
||||||
@@ -75,7 +79,7 @@ function TeamController(props: Props) {
|
|||||||
return () => {
|
return () => {
|
||||||
clearInterval(wakeUpIntervalId);
|
clearInterval(wakeUpIntervalId);
|
||||||
};
|
};
|
||||||
}, []);
|
}, [props.disableWakeUpReconnectHandler]);
|
||||||
|
|
||||||
// Effect runs on mount, add event listeners on windows object
|
// Effect runs on mount, add event listeners on windows object
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -899,6 +899,8 @@
|
|||||||
"admin.experimental.disableAppBar.title": "Disable Apps Bar:",
|
"admin.experimental.disableAppBar.title": "Disable Apps Bar:",
|
||||||
"admin.experimental.disableRefetchingOnBrowserFocus.desc": "When true, Mattermost will not refetch channels and channel members when the browser regains focus. This may result in improved performance for users with many channels and channel members.",
|
"admin.experimental.disableRefetchingOnBrowserFocus.desc": "When true, Mattermost will not refetch channels and channel members when the browser regains focus. This may result in improved performance for users with many channels and channel members.",
|
||||||
"admin.experimental.disableRefetchingOnBrowserFocus.title": "Disable data refetching on browser refocus:",
|
"admin.experimental.disableRefetchingOnBrowserFocus.title": "Disable data refetching on browser refocus:",
|
||||||
|
"admin.experimental.disableWakeUpReconnectHandler.desc": "When true, Mattermost will not attempt to detect when the computer has woken up and refetch data. This might reduce the amount of regular network traffic the app is sending.",
|
||||||
|
"admin.experimental.disableWakeUpReconnectHandler.title": "Disable Wake Up Reconnect Handler:",
|
||||||
"admin.experimental.emailBatchingBufferSize.desc": "Specify the maximum number of notifications batched into a single email.",
|
"admin.experimental.emailBatchingBufferSize.desc": "Specify the maximum number of notifications batched into a single email.",
|
||||||
"admin.experimental.emailBatchingBufferSize.example": "E.g.: \"256\"",
|
"admin.experimental.emailBatchingBufferSize.example": "E.g.: \"256\"",
|
||||||
"admin.experimental.emailBatchingBufferSize.title": "Email Batching Buffer Size:",
|
"admin.experimental.emailBatchingBufferSize.title": "Email Batching Buffer Size:",
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export type ClientConfig = {
|
|||||||
DiagnosticId: string;
|
DiagnosticId: string;
|
||||||
DiagnosticsEnabled: string;
|
DiagnosticsEnabled: string;
|
||||||
DisableRefetchingOnBrowserFocus: string;
|
DisableRefetchingOnBrowserFocus: string;
|
||||||
|
DisableWakeUpReconnectHandler: string;
|
||||||
EmailLoginButtonBorderColor: string;
|
EmailLoginButtonBorderColor: string;
|
||||||
EmailLoginButtonColor: string;
|
EmailLoginButtonColor: string;
|
||||||
EmailLoginButtonTextColor: string;
|
EmailLoginButtonTextColor: string;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user