Skip to content
Snippets Groups Projects
Unverified Commit 80fc038f authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Add setting to disable oplog for cache sync

parent 8f136fc6
No related merge requests found
......@@ -522,6 +522,8 @@
"Food_and_Drink": "Food & Drink",
"Footer": "Footer",
"For_your_security_you_must_enter_your_current_password_to_continue": "For your security, you must enter your current password to continue",
"Force_Disable_OpLog_For_Cache": "Force disable OpLog for Cache",
"Force_Disable_OpLog_For_Cache_Description": "Will not use OpLog to sync cache even when it's available",
"Force_SSL": "Force SSL",
"Force_SSL_Description": "*Caution!* _Force SSL_ should never be used with reverse proxy. If you have a reverse proxy, you should do the redirect THERE. This option exists for deployments like Heroku, that does not allow the redirect configuration at the reverse proxy.",
"Forgot_password": "Forgot your password",
......@@ -1516,4 +1518,4 @@
"your_message_optional": "your message (optional)",
"Your_password_is_wrong": "Your password is wrong!",
"Your_push_was_sent_to_s_devices": "Your push was sent to %s devices"
}
\ No newline at end of file
}
......@@ -29,7 +29,7 @@ class ModelsBaseDb extends EventEmitter {
this.wrapModel();
this.isOplogAvailable = MongoInternals.defaultRemoteCollectionDriver().mongo._oplogHandle && !!MongoInternals.defaultRemoteCollectionDriver().mongo._oplogHandle.onOplogEntry;
this.isOplogAvailable = MongoInternals.defaultRemoteCollectionDriver().mongo._oplogHandle && !!MongoInternals.defaultRemoteCollectionDriver().mongo._oplogHandle.onOplogEntry && RocketChat.settings.get('Force_Disable_OpLog_For_Cache') === false;
// When someone start listening for changes we start oplog if available
this.once('newListener', (event/*, listener*/) => {
......@@ -130,6 +130,10 @@ class ModelsBaseDb extends EventEmitter {
}
processOplogRecord(action) {
if (this.isOplogAvailable === false) {
return;
}
if (action.op.op === 'i') {
this.emit('change', {
action: 'insert',
......
......@@ -99,6 +99,7 @@ RocketChat.settings.addGroup 'General', ->
@add 'Force_SSL', false, { type: 'boolean', public: true }
@add 'GoogleTagManager_id', '', { type: 'string', public: true }
@add 'Bugsnag_api_key', '', { type: 'string', public: false }
@add 'Force_Disable_OpLog_For_Cache', false, { type: 'boolean', public: false }
@add 'Restart', 'restart_server', { type: 'action', actionText: 'Restart_the_server' }
@section 'UTF8', ->
......
Meteor.startup ->
isOplogState = 'Enabled'
if not MongoInternals.defaultRemoteCollectionDriver().mongo._oplogHandle?
isOplogState = 'Disabled'
oplogState = 'Disabled'
if MongoInternals.defaultRemoteCollectionDriver().mongo._oplogHandle?.onOplogEntry?
oplogState = 'Enabled'
if RocketChat.settings.get('Force_Disable_OpLog_For_Cache') is true
oplogState += ' (Disabled for Cache Sync)'
Meteor.setTimeout ->
msg = [
" Version: #{RocketChat.Info.version}"
"Process Port: #{process.env.PORT}"
" Site URL: #{RocketChat.settings.get('Site_Url')}"
" OpLog: #{isOplogState}"
" OpLog: #{oplogState}"
].join('\n')
SystemLogger.startup_box msg, 'SERVER RUNNING'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment