proc/worker/client.go
func (w *Worker) ClientPreServiceTerminate(job *data.Job) error {
	logger := w.logger.Add("method", "ClientPreServiceTerminate", "job", job)

	ch, err := w.relatedChannel(logger,
		job, data.JobClientPreServiceTerminate)
	if err != nil {
		return err
	}

	logger = logger.Add("channel", ch)

	if ch.ServiceStatus == data.ServiceActive {
		ch.ServiceStatus = data.ServiceTerminating
	} else {
		ch.ServiceStatus = data.ServiceTerminated
	}

	changedTime := time.Now()
	ch.ServiceChangedTime = &changedTime
	err = w.saveRecord(logger, w.db.Querier, ch)
	if err != nil {
		return err
	}
	return nil
}
func (w *Worker) ClientPreServiceTerminate(job *data.Job) error {
	logger := w.logger.Add("method", "ClientPreServiceTerminate", "job", job)

	ch, err := w.relatedChannel(logger,
		job, data.JobClientPreServiceTerminate)
	if err != nil {
		return err
	}

	logger = logger.Add("channel", ch)

	if ch.ServiceStatus == data.ServiceActive {
		ch.ServiceStatus = data.ServiceTerminating
	} else {
		ch.ServiceStatus = data.ServiceTerminated
	}

	changedTime := time.Now()
	ch.ServiceChangedTime = &changedTime
	err = w.saveRecord(logger, w.db.Querier, ch)
	if err != nil {
		return err
	}
	return nil
}
// ClientPreServiceTerminate terminates service.