onMessageFromWorker =
  (masterState, { port, host, watchReaper, disableScheduler, pid }) =>
  (msg) => {
    //console.log("worker msg", typeof msg, msg);
    if (msg === "Start" && !masterState.started) {
      masterState.started = true;
      runScheduler({
        port,
        host,
        watchReaper,
        disableScheduler,
        eachTenant,
        auto_backup_now,
        take_snapshot,
      });
      require("./systemd")({ port });
      return true;
    } else if (msg === "RestartServer") {
      process.exit(0);
      return true;
    } else if (msg.tenant || msg.createTenant) {
      ///ie from saltcorn
      //broadcast
      Object.entries(cluster.workers).forEach(([wpid, w]) => {
        if (wpid !== pid) w.send(msg);
      });
      workerDispatchMsg(msg); //also master
      return true;
    }
  }
@param {*} masterState
@param {object} opts
@param {string} opts.port
@param {string} opts.host
@param {boolean} opts.watchReaper
@param {boolean} opts.disableScheduler
@param {number} opts.pid
@returns {function}