private async Task <PersistentEvent> CreateSessionStartEventAsync(EventContext startContext, DateTime?lastActivityUtc, bool?isSessionEnd) { var startEvent = startContext.Event.ToSessionStartEvent(lastActivityUtc, isSessionEnd, startContext.Organization.HasPremiumFeatures, startContext.IncludePrivateInformation); var startEventContexts = new List <EventContext> { new EventContext(startEvent, startContext.Organization, startContext.Project) }; if (_assignToStack.Enabled) { await _assignToStack.ProcessBatchAsync(startEventContexts).AnyContext(); } if (_updateStats.Enabled) { await _updateStats.ProcessBatchAsync(startEventContexts).AnyContext(); } await _eventRepository.AddAsync(startEvent).AnyContext(); if (_locationPlugin.Enabled) { await _locationPlugin.EventBatchProcessedAsync(startEventContexts).AnyContext(); } await SetSessionStartEventIdAsync(startContext.Project.Id, startContext.Event.GetSessionId(), startEvent.Id).AnyContext(); return(startEvent); }
private async Task <EventContext> CreateSessionStartEventAsync(EventContext context, DateTime?lastActivityUtc, bool?isSessionEnd) { var startEvent = context.Event.ToSessionStartEvent(lastActivityUtc, isSessionEnd, context.Organization.HasPremiumFeatures); var startEventContexts = new List <EventContext> { new EventContext(startEvent) { Project = context.Project, Organization = context.Organization } }; await _assignToStack.ProcessBatchAsync(startEventContexts).AnyContext(); await _updateStats.ProcessBatchAsync(startEventContexts).AnyContext(); await _eventRepository.AddAsync(startEvent).AnyContext(); await _locationPlugin.EventBatchProcessedAsync(startEventContexts).AnyContext(); return(startEventContexts.Single()); }