Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove Troubleshoot options #30429

Merged
merged 6 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 6 additions & 20 deletions apps/meteor/app/cloud/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { cronJobs } from '@rocket.chat/cron';
import { Meteor } from 'meteor/meteor';

import { SystemLogger } from '../../../server/lib/logger/system';
import { settings } from '../../settings/server';
import { connectWorkspace } from './functions/connectWorkspace';
import { getWorkspaceAccessToken } from './functions/getWorkspaceAccessToken';
import { getWorkspaceAccessTokenWithScope } from './functions/getWorkspaceAccessTokenWithScope';
Expand All @@ -13,24 +12,6 @@ import './methods';
const licenseCronName = 'Cloud Workspace Sync';

Meteor.startup(async () => {
// run token/license sync if registered
let TroubleshootDisableWorkspaceSync: boolean;
settings.watch<boolean>('Troubleshoot_Disable_Workspace_Sync', async (value) => {
if (TroubleshootDisableWorkspaceSync === value) {
return;
}
TroubleshootDisableWorkspaceSync = value;

if (value) {
return cronJobs.remove(licenseCronName);
}

setImmediate(() => syncWorkspace());
await cronJobs.add(licenseCronName, '0 */12 * * *', async () => {
await syncWorkspace();
});
});

const { workspaceRegistered } = await retrieveRegistrationStatus();

if (process.env.REG_TOKEN && process.env.REG_TOKEN !== '' && !workspaceRegistered) {
Expand All @@ -43,9 +24,14 @@ Meteor.startup(async () => {

console.log('Successfully registered with token provided by REG_TOKEN!');
} catch (e: any) {
SystemLogger.error('An error occured registering with token.', e.message);
SystemLogger.error('An error occurred registering with token.', e.message);
}
}

setImmediate(() => syncWorkspace());
await cronJobs.add(licenseCronName, '0 */12 * * *', async () => {
await syncWorkspace();
});
});

export { getWorkspaceAccessToken, getWorkspaceAccessTokenWithScope };
4 changes: 0 additions & 4 deletions apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -5174,10 +5174,6 @@
"Troubleshoot_Disable_Presence_Broadcast_Alert": "This setting prevents all instances form sending the status changes of the users to their clients keeping all the users with their presence status from the first load!",
"Troubleshoot_Disable_Sessions_Monitor": "Disable Sessions Monitor",
"Troubleshoot_Disable_Sessions_Monitor_Alert": "This setting stops the processing of user sessions causing the statistics to stop working correctly!",
"Troubleshoot_Disable_Statistics_Generator": "Disable Statistics Generator",
"Troubleshoot_Disable_Statistics_Generator_Alert": "This setting stops the processing all statistics making the info page outdated until someone clicks on the refresh button and may cause other missing information around the system!",
"Troubleshoot_Disable_Workspace_Sync": "Disable Workspace Sync",
"Troubleshoot_Disable_Workspace_Sync_Alert": "This setting stops the sync of this server with Rocket.Chat's cloud and may cause issues with marketplace and enteprise licenses!",
"Troubleshoot_Disable_Teams_Mention": "Disable Teams mention",
"Troubleshoot_Disable_Teams_Mention_Alert": "This setting disables the teams mention feature. User's won't be able to mention a Team by name in a message and get its members notified.",
"True": "True",
Expand Down
24 changes: 3 additions & 21 deletions apps/meteor/server/cron/statistics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,10 @@ async function generateStatistics(logger: Logger): Promise<void> {
}

export async function statsCron(logger: Logger): Promise<void> {
if (settings.get('Troubleshoot_Disable_Statistics_Generator')) {
return;
}

const name = 'Generate and save statistics';
await generateStatistics(logger);

let previousValue: boolean;
settings.watch<boolean>('Troubleshoot_Disable_Statistics_Generator', async (value) => {
if (value === previousValue) {
return;
}
previousValue = value;

if (value) {
await cronJobs.remove(name);
return;
}

await generateStatistics(logger);

const now = new Date();
const now = new Date();

await cronJobs.add(name, `12 ${now.getHours()} * * *`, async () => generateStatistics(logger));
});
await cronJobs.add(name, `12 ${now.getHours()} * * *`, async () => generateStatistics(logger));
}
10 changes: 1 addition & 9 deletions apps/meteor/server/settings/troubleshoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const createTroubleshootSettings = () =>
i18nDescription: 'Troubleshoot_Disable_Presence_Broadcast_Alert',
enableQuery: { _id: 'Presence_broadcast_disabled', value: false },
});

await this.add('Troubleshoot_Disable_Instance_Broadcast', false, {
type: 'boolean',
i18nDescription: 'Troubleshoot_Disable_Instance_Broadcast_Alert',
Expand All @@ -32,18 +31,11 @@ export const createTroubleshootSettings = () =>
type: 'boolean',
i18nDescription: 'Troubleshoot_Disable_Livechat_Activity_Monitor_Alert',
});
await this.add('Troubleshoot_Disable_Statistics_Generator', false, {
type: 'boolean',
i18nDescription: 'Troubleshoot_Disable_Statistics_Generator_Alert',
});
await this.add('Troubleshoot_Disable_Data_Exporter_Processor', false, {
type: 'boolean',
i18nDescription: 'Troubleshoot_Disable_Data_Exporter_Processor_Alert',
});
await this.add('Troubleshoot_Disable_Workspace_Sync', false, {
type: 'boolean',
i18nDescription: 'Troubleshoot_Disable_Workspace_Sync_Alert',
});

await this.add('Troubleshoot_Disable_Teams_Mention', false, {
type: 'boolean',
i18nDescription: 'Troubleshoot_Disable_Teams_Mention_Alert',
Expand Down
Loading