Skip to content

Commit

Permalink
Troubleshoot_Disable_Workspace_Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Sep 18, 2023
1 parent 76ef8f7 commit 13ecb9d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 27 deletions.
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 };
2 changes: 0 additions & 2 deletions apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -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_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
5 changes: 0 additions & 5 deletions apps/meteor/server/settings/troubleshoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ export const createTroubleshootSettings = () =>
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

0 comments on commit 13ecb9d

Please sign in to comment.