public async Task <ExceptionInfo> CreateAsync(CreateExceptionRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } // 1 per millisecond for now... var id = RequestId.Create( request.EnvironmentId, request.Created ?? DateTime.UtcNow, 0 // TODO: Random ); var ex = new ExceptionInfo { Id = id, ProgramId = request.ProgramId, Context = request.Context, Properties = request.Properties, HostId = request.HostId, Message = request.Message, Type = request.Type, StackTrace = request.StackTrace, RequestId = request.RequestId }; await db.Exceptions.InsertAsync(ex); return(ex); }
void InitiateRequest(Client client) { if (!_client.IsAssignedToServer(client.Id)) { return; } var owner = _user.CreateUser(client.Id); var req = new Request(RequestId.Create(), ServerType.Client, owner, client.WantedNetwork, client.WantedCPU, client.WantedRAM); _request.Add(req); }
public void AddRelatedRequests(Request req) { var addServers = _user.GetAdditionalServers(req.Owner); if (addServers == null) { return; } foreach (var serverType in addServers) { var newReq = new Request(RequestId.Create(), serverType, req.Owner, req.WantedNetwork, req.WantedCPU, req.WantedRAM); Add(newReq); } }
public async Task <IReadOnlyList <ExceptionInfo> > ListAsync(long environmentId, int skip = 0, int take = 100) { var start = RequestId.Create(environmentId, DateTime.UtcNow.AddYears(-10), 0); var end = RequestId.Create(environmentId, DateTime.UtcNow.AddYears(10), 0); var result = await db.Exceptions.QueryAsync( expression : Between("id", start, end), order : Order.Descending("id"), skip : skip, take : take ).ConfigureAwait(false); return(result); }
public async Task InvokeAsync(HttpContext httpContext) { RequestId.Create(httpContext.TraceIdentifier); await NextRequest(httpContext); }