Merge pull request #3682 from overleaf/bg-check-maintenance-file

check maintenance file periodically to close site

GitOrigin-RevId: 8e29f40a23df96198c6e4603ede2bab852b98740
This commit is contained in:
Brian Gough
2021-02-26 03:04:07 +00:00
committed by Copybot
parent 54212385e6
commit bc4f5a687a
6 changed files with 35 additions and 19 deletions
@@ -249,22 +249,25 @@ export default ConnectionManager = (function() {
// Site administrators can send the forceDisconnect event to all users
this.ide.socket.on('forceDisconnect', message => {
this.ide.socket.on('forceDisconnect', (message, delay = 10) => {
this.updateConnectionManagerState('inactive')
this.shuttingDown = true // prevent reconnection attempts
this.$scope.$apply(() => {
this.$scope.permissions.write = false
return (this.$scope.connection.forced_disconnect = true)
})
this.ide.socket.disconnect()
this.ide.showGenericMessageModal(
'Please Refresh',
// flush changes before disconnecting
this.ide.$scope.$broadcast('flush-changes')
setTimeout(() => this.ide.socket.disconnect(), 1000)
this.ide.showLockEditorMessageModal(
'Please wait',
`\
We're performing maintenance on Overleaf and you need to refresh the editor.
We're performing maintenance on Overleaf and you need to wait a moment.
Sorry for any inconvenience.
The editor will refresh in automatically in 10 seconds.\
The editor will refresh automatically in ${delay} seconds.\
`
)
return setTimeout(() => location.reload(), 10 * 1000)
return setTimeout(() => location.reload(), delay * 1000)
})
this.ide.socket.on('reconnectGracefully', () => {