Add estimated wait time #26
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#26
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?
Potential implementation for rough estimate:
Add property AccessGrantedOn to User object
Set AccessGrantedOn = DateTime.UtcNow whenever user is granted access
Define a constant for sample time SAMPLE_PERIOD
int usersAddedRecently = accessTickets where AccessGrantedOn < UtcNow - SAMPLE_PERIOD
const avgReleaseTime = SAMPLE_PERIOD / usersAddedRecently
estimatedWaitTime = avgReleaseTime * requestsAhead
Estimating avgReleaseTime will require iterating entire access dictionary
For performance we should do this periodically and cache avgReleaseTime
Also, there should be a threshold for when an estimate is given. Estimate shouldn't be given if there isn't enough data to make a good guess. Maybe at least 2 users in SAMPLE_PERIOD
This is a poor estimate but would be quick to implement
For a better estimate I would have to track how long each user spends active once they get access. This still isn't perfect because there isn't a definite end to a session. If user A goes inactive, user B gains access, then user A comes back, the number of simultaneous user exceeds capacity, which the algorithm doesn't account for. Unsure how often this would happen, but it would inflate queue time.