public async Task Register(AgentRecord agentRecord, CancellationToken token = default) { agentRecord.VerifyNotNull(nameof(agentRecord)); _logger.LogTrace($"{nameof(Register)}: agentId={agentRecord.Id}, state={agentRecord.State}"); await _agentContainer.Set(agentRecord, token : token); }
public static bool IsAgentRunning(this AgentRecord agentRecord, TimeSpan offlineTolerance) { agentRecord.VerifyNotNull(nameof(agentRecord)); return(agentRecord.State == AgentState.Running && DateTime.UtcNow - agentRecord.UtcHeartbeat <= offlineTolerance); }