Child pages
  • Maintenance Mode

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Before importing the solution, connected clients are notified that an import will take place, then they are disconnected and then the server is put into maintenance mode, so that no new clients can connect during the import.
  • The import is performed as usually.
  • After the import is over, the server is taken out of maintenance mode, so that clients can connect again.

All these steps can be automated if you create a pre-import and a post-import hook module. The pre-import hook module can have the following function set as its onOpen event handler:

Code Block
JavaScript
JavaScript

function onBeforeImportSolutionOpen()
{
	application.output("Notifying and disconnecting connected clients...");
	plugins.maintenance.sendMessageToAllClients("A solution upgrade will take place on the server. You will be disconnected in 2 minutes.");
	application.sleep(2 * 60 * 1000);
	plugins.maintenance.sendMessageToAllClients("A solution upgrade will take place on the server. You will be disconnected NOW.");
	plugins.maintenance.shutDownAllClients();
	application.output("Putting server into maintenance mode...");
	plugins.maintenance.setMaintenanceMode(true);
	application.output("Proceeding to import...");
}

The post-import hook module can have the following function as its onOpen event handler:

Code Block
JavaScript
JavaScript

function onAfterImportSolutionOpen()
{
	application.output("Taking server out of maintenance mode.");
	plugins.maintenance.setMaintenanceMode(false);
	application.output("Clients can now connect to the server.");
}