コード例 #1
0
 protected override void OnStop()
 {
     Try(nameof(OnStop),
         () =>
     {
         if (_server != null)
         {
             GrpcServerUtils.GracefullyStop(_server);
         }
     });
 }
コード例 #2
0
        private void _timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (_health == null)
            {
                return;
            }

            if (_health.IsAnyServiceUnhealthy())
            {
                _health = null;

                _msg.Warn("Shutting down due to unhealthy service...");

                GrpcServerUtils.GracefullyStop(_server);

                // This allows the auto-restart to kick in:
                Environment.Exit(-1);
            }
        }