/// <summary>
        /// Performs a health check.
        /// </summary>
        private void CheckHealth(object sender, ElapsedEventArgs elapsedEventArgs)
        {
            if (_retryLimit != -1 && _currentRetries == _retryLimit)
            {
                _logger.LogWarning($"Max retry attempts reached. Retried {_retryLimit} times");
                MaxRetriesReached?.Invoke(this, new EventArgs());
                _timer.Stop();
                return;
            }

            if (_prevTask?.IsCompleted ?? true)
            {
                _prevTask = Task.Run(() =>
                {
                    _logger.LogInformation($"[{_cameraConfig.CameraName}] Starting health check");
                    var ffProbe = new Process();
                    ffProbe.StartInfo.UseShellExecute = false;
                    ffProbe.StartInfo.CreateNoWindow  = true;
                    ffProbe.StartInfo.FileName        = "ffprobe";

                    ffProbe.StartInfo.Arguments = $"-loglevel quiet rtmp://localhost:1935/live/{_cameraConfig.CameraName}";
                    ffProbe.Start();

                    // Wait for the process to exit or timeout
                    var didExit = ffProbe.WaitForExit((int)TimeSpan.FromSeconds(30).TotalMilliseconds);

                    // If the timeout occurred then lets assume camera is not healthy.
                    // An exit code of 0 indicates success otherwise.
                    _isHealthy = didExit && ffProbe.ExitCode == 0;
                    _logger.LogInformation($"[{_cameraConfig.CameraName}] {(_isHealthy ? "IS" : "IS NOT")} healthy");

                    ffProbe.Kill();
                    if (_isHealthy)
                    {
                        // Reset retry count since things seem good
                        _currentRetries = 0;
                    }
                    else
                    {
                        UnhealthyResult?.Invoke(this, new EventArgs());
                        _currentRetries++;
                    }
                });
            }
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = RechargeProductId.GetHashCode();
         hashCode = (hashCode * 397) ^ SkuOverride.GetHashCode();
         hashCode = (hashCode * 397) ^ Id.GetHashCode();
         hashCode = (hashCode * 397) ^ AddressId.GetHashCode();
         hashCode = (hashCode * 397) ^ CustomerId.GetHashCode();
         hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ NextChargeScheduledAt.GetHashCode();
         hashCode = (hashCode * 397) ^ CancelledAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (ProductTitle != null ? ProductTitle.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VariantTitle != null ? VariantTitle.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Price.GetHashCode();
         hashCode = (hashCode * 397) ^ Quantity.GetHashCode();
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ShopifyProductId.GetHashCode();
         hashCode = (hashCode * 397) ^ ShopifyVariantId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Sku != null ? Sku.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OrderIntervalUnit != null ? OrderIntervalUnit.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^
                    (OrderIntervalFrequency != null ? OrderIntervalFrequency.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^
                    (ChargeIntervalFrequency != null ? ChargeIntervalFrequency.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CancellationReason != null ? CancellationReason.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^
                    (CancellationReasonComments != null ? CancellationReasonComments.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ OrderDayOfWeek.GetHashCode();
         hashCode = (hashCode * 397) ^ OrderDayOfMonth.GetHashCode();
         hashCode = (hashCode * 397) ^ ExpireAfterSpecificNumberOfCharges.GetHashCode();
         hashCode = (hashCode * 397) ^ MaxRetriesReached.GetHashCode();
         hashCode = (hashCode * 397) ^ HasQueuedCharges.GetHashCode();
         hashCode = (hashCode * 397) ^ CommitUpdate.GetHashCode();
         return(hashCode);
     }
 }