pingProcess method

Future<PingProcessResponse?> pingProcess(
  1. String account,
  2. String process
)

Ping

Action to maintain a process heartbeat ping frequency. When a process has not performed a heartbeat ping within the monitor window, it will be considered dead and queued for deletion. This can be utilized for process leasing, where a license or machine has a maximum number of allowed processes, and each process must maintain heartbeat pings in order to remain active. This can be used in combination with machine heartbeats. Consider this common process leasing scenario: - One or more processes are spawned during application initialization, after the license has been validated and the underlying machine has been activated. - Each process sends their first ping and maintains a heartbeat ping frequency, according to the required heartbeat monitor window, to indicate that it is still alive. - The application crashes. The normal process kill-on-exit procedure fails to occur before the application exits. There are now one or more "zombie" processes. - The heartbeat monitor detects that the process has not sent a ping within the window, and subsequently kills the process. The default heartbeat monitor window is 10 minutes. This can be configured to a different value via the license policy's heartbeat duration attribute. Processes will be culled according to the policy's heartbeat cull strategy, after the process's resurrection period has passed, if set.

Parameters:

  • String account (required): The identifier (UUID) or slug of your Keygen account.

  • String process (required): The identifier (UUID) of the process to ping.

Implementation

Future<PingProcessResponse?> pingProcess(String account, String process,) async {
  final response = await pingProcessWithHttpInfo(account, process,);
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'PingProcessResponse',) as PingProcessResponse;

  }
  return null;
}