Sleep and wakeup

Event Listener: Skynet\EventListener\SkynetEventListenerSleeper

Every cluster can be remotely "sleeped". Sleeped clusters are not broadcasting and they not generate responses.

If you want to sleep specified cluster, type in webconsole:

  1. @sleep "CLUSTER_ADDRESS";

or

  1. @sleep "CLUSTER_ADDRESS1", "CLUSTER_ADDRESS2", "CLUSTER_ADDRESS3"...;

If you want to sleep your own cluster, type:

  1. @sleep me;

In Event Listener you will do it with:

/src/SkynetUser/MyListener.php:
  1. public function onRequest($context)
  2. {
  3. if($context == "beforeSend")
  4. {
  5. $this->request->set('@sleep', '1');
  6. }
  7. }

Alternatively, you can sleep cluster via setting option sleep to value "1":

  1. @opt_set sleep:"1";

In Event Listener (it will work only for THIS cluster):

/src/SkynetUser/MyListener.php:
  1. public function onRequest($context)
  2. {
  3. if($context == "beforeSend")
  4. {
  5. $this->opt_set('sleep', 1);
  6. }
  7. }

When sleep, you can restore cluster by wake up it.
To wakeup cluster just use:

  1. @wakeup "CLUSTER_ADDRESS";

or

  1. @wakeup CLUSTER_ADDRESS1, CLUSTER_ADDRESS2, CLUSTER_ADDRESS3...;

to wakeup remote cluster.

OR:

  1. @wakeup me;

if you want to wake up your own cluster.

Alternatively, you can wakeup cluster by setting option sleep to "0":

  1. @opt_set sleep:"0";
Full API Documentation is included in Skynet packages available on GitHub.