From 20bd4451963b55bac6321acb097713176bb89408 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Mon, 18 Sep 2023 11:50:33 -0300 Subject: [PATCH] Troubleshoot_Disable_Statistics_Generator --- .../rocketchat-i18n/i18n/en.i18n.json | 2 -- apps/meteor/server/cron/statistics.ts | 24 +++---------------- apps/meteor/server/settings/troubleshoot.ts | 15 +++++------- 3 files changed, 9 insertions(+), 32 deletions(-) diff --git a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json index a0f6d0e0c6a8..7e40f9f283a9 100644 --- a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json @@ -5174,8 +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", diff --git a/apps/meteor/server/cron/statistics.ts b/apps/meteor/server/cron/statistics.ts index b6f58b66d383..27c1fc064e25 100644 --- a/apps/meteor/server/cron/statistics.ts +++ b/apps/meteor/server/cron/statistics.ts @@ -32,28 +32,10 @@ async function generateStatistics(logger: Logger): Promise { } export async function statsCron(logger: Logger): Promise { - if (settings.get('Troubleshoot_Disable_Statistics_Generator')) { - return; - } - const name = 'Generate and save statistics'; + await generateStatistics(logger); - let previousValue: boolean; - settings.watch('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)); } diff --git a/apps/meteor/server/settings/troubleshoot.ts b/apps/meteor/server/settings/troubleshoot.ts index bc1cd1484301..a73cc2afd10f 100644 --- a/apps/meteor/server/settings/troubleshoot.ts +++ b/apps/meteor/server/settings/troubleshoot.ts @@ -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', @@ -32,18 +31,16 @@ 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_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',