Improve efficiency for large capacities #14
Labels
No Label
bug
enhancement
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: henry/AccessQueueService#14
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The service can easily handle thousands of users in the queue, but it starts to crawl when the capacity limit is high and there are many active users with access. This is because there is an expensive iteration done every time an access request is made:
var numberOfActiveUsers = _accessTickets.Count(t => t.Value.ExpiresOn > now && t.Value.LastActive > activeCutoff);
numberOfActiveUsers
could either be cached so not every request iterates on the array, or it could be done periodically in the backgorund.As far as I can tell, all individual actions taken have O(1) complexity except for this step in requesting access. If this is resolved the overall complexity for requesting access with drop to O(1)