fix(IPC-36,IPC-37): guard secondary contracts
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Diagnostics;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using ZB.MOM.WW.MxGateway.Contracts;
|
||||
using ZB.MOM.WW.MxGateway.Server.Configuration;
|
||||
using ZB.MOM.WW.MxGateway.Server.Metrics;
|
||||
using Polly;
|
||||
@@ -15,41 +16,47 @@ namespace ZB.MOM.WW.MxGateway.Server.Workers;
|
||||
public sealed class WorkerProcessLauncher : IWorkerProcessLauncher
|
||||
{
|
||||
/// <summary>Environment variable for worker nonce.</summary>
|
||||
public const string WorkerNonceEnvironmentVariableName = "MXGATEWAY_WORKER_NONCE";
|
||||
[Obsolete("Use WorkerLaunchEnvironment.WorkerNonce.")]
|
||||
public const string WorkerNonceEnvironmentVariableName = WorkerLaunchEnvironment.WorkerNonce;
|
||||
|
||||
/// <summary>Environment variable for worker pipe connect attempt timeout.</summary>
|
||||
[Obsolete("Use WorkerLaunchEnvironment.PipeConnectAttemptTimeoutMilliseconds.")]
|
||||
public const string WorkerPipeConnectAttemptTimeoutEnvironmentVariableName =
|
||||
"MXGATEWAY_WORKER_PIPE_CONNECT_ATTEMPT_TIMEOUT_MS";
|
||||
WorkerLaunchEnvironment.PipeConnectAttemptTimeoutMilliseconds;
|
||||
|
||||
/// <summary>
|
||||
/// Conveys MxGateway:Worker:WriteCompletionWaitMilliseconds to the worker:
|
||||
/// the bounded wait for the OnWriteComplete callback on
|
||||
/// WriteSecured/WriteSecured2 replies. 0 disables the wait.
|
||||
/// the bounded wait for the OnWriteComplete callback on Write, Write2,
|
||||
/// WriteSecured, and WriteSecured2 replies. 0 disables the wait.
|
||||
/// </summary>
|
||||
[Obsolete("Use WorkerLaunchEnvironment.WriteCompletionWaitMilliseconds.")]
|
||||
public const string WorkerWriteCompletionWaitEnvironmentVariableName =
|
||||
"MXGATEWAY_WORKER_WRITE_COMPLETION_WAIT_MS";
|
||||
WorkerLaunchEnvironment.WriteCompletionWaitMilliseconds;
|
||||
|
||||
/// <summary>
|
||||
/// Conveys MxGateway:Alarms:PollIntervalMilliseconds to the worker: the
|
||||
/// cadence at which the worker's STA polls the AVEVA alarm consumer.
|
||||
/// </summary>
|
||||
[Obsolete("Use WorkerLaunchEnvironment.AlarmPollIntervalMilliseconds.")]
|
||||
public const string WorkerAlarmPollIntervalEnvironmentVariableName =
|
||||
"MXGATEWAY_ALARM_POLL_INTERVAL_MS";
|
||||
WorkerLaunchEnvironment.AlarmPollIntervalMilliseconds;
|
||||
|
||||
/// <summary>
|
||||
/// Conveys MxGateway:Alarms:MaxAlarmsPerFetch to the worker: the cap
|
||||
/// passed to GetXmlCurrentAlarms2, which is also the record count at
|
||||
/// which the worker treats a fetch as truncated.
|
||||
/// </summary>
|
||||
[Obsolete("Use WorkerLaunchEnvironment.MaxAlarmsPerFetch.")]
|
||||
public const string WorkerMaxAlarmsPerFetchEnvironmentVariableName =
|
||||
"MXGATEWAY_ALARM_MAX_ALARMS_PER_FETCH";
|
||||
WorkerLaunchEnvironment.MaxAlarmsPerFetch;
|
||||
|
||||
/// <summary>
|
||||
/// Conveys MxGateway:Worker:EventQueueCapacity to the worker: the capacity
|
||||
/// of the outbound MXAccess event queue, whose overflow faults the session.
|
||||
/// </summary>
|
||||
[Obsolete("Use WorkerLaunchEnvironment.EventQueueCapacity.")]
|
||||
public const string WorkerEventQueueCapacityEnvironmentVariableName =
|
||||
"MXGATEWAY_EVENT_QUEUE_CAPACITY";
|
||||
WorkerLaunchEnvironment.EventQueueCapacity;
|
||||
|
||||
private readonly IWorkerProcessFactory _processFactory;
|
||||
private readonly IWorkerStartupProbe _startupProbe;
|
||||
@@ -204,16 +211,16 @@ public sealed class WorkerProcessLauncher : IWorkerProcessLauncher
|
||||
startInfo.ArgumentList.Add(argument);
|
||||
}
|
||||
|
||||
startInfo.Environment[WorkerNonceEnvironmentVariableName] = request.Nonce;
|
||||
startInfo.Environment[WorkerPipeConnectAttemptTimeoutEnvironmentVariableName] =
|
||||
startInfo.Environment[WorkerLaunchEnvironment.WorkerNonce] = request.Nonce;
|
||||
startInfo.Environment[WorkerLaunchEnvironment.PipeConnectAttemptTimeoutMilliseconds] =
|
||||
_workerOptions.PipeConnectAttemptTimeoutMilliseconds.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
startInfo.Environment[WorkerWriteCompletionWaitEnvironmentVariableName] =
|
||||
startInfo.Environment[WorkerLaunchEnvironment.WriteCompletionWaitMilliseconds] =
|
||||
_workerOptions.WriteCompletionWaitMilliseconds.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
startInfo.Environment[WorkerEventQueueCapacityEnvironmentVariableName] =
|
||||
startInfo.Environment[WorkerLaunchEnvironment.EventQueueCapacity] =
|
||||
_workerOptions.EventQueueCapacity.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
startInfo.Environment[WorkerAlarmPollIntervalEnvironmentVariableName] =
|
||||
startInfo.Environment[WorkerLaunchEnvironment.AlarmPollIntervalMilliseconds] =
|
||||
_alarmsOptions.PollIntervalMilliseconds.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
startInfo.Environment[WorkerMaxAlarmsPerFetchEnvironmentVariableName] =
|
||||
startInfo.Environment[WorkerLaunchEnvironment.MaxAlarmsPerFetch] =
|
||||
_alarmsOptions.MaxAlarmsPerFetch.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
|
||||
commandLine = new WorkerProcessCommandLine(executablePath, arguments);
|
||||
|
||||
Reference in New Issue
Block a user