Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load autostaff worker hours once per run #787

Merged
merged 2 commits into from Jul 2, 2021
Merged

Conversation

marcua
Copy link
Member

@marcua marcua commented Jun 30, 2021

  • Bug
    • Our autostaffing logic loops over all staffable requests and checks if an expert has available hours for the day. It queries the database for availability on each request.
    • As a result, if an expert increases her availability while autostaffing is running across all staffable tasks, or if autostaffing is running across a midnight barrier, a staffing request that is lower-priority might be the one that is checked immediately after new availability is discovered. This causes a lower-priority request to be staffed.
  • Solution: Compute worker hours availability before autostaffing begins and use that consistent value in every staffing decision.
  • Test that it worked
    • Run autostaffing and find that it doesn't staff anyone
    • Run autostaffing and concurrently increase an expert's availability
    • Ensure no tasks were staffed
    • Run autostaffing again, and ensure that the highest-priority tasks are staffed

today.weekday()]
return {
availability.worker.id:
min(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a comment explaining the two things we're min-ning here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! TY!

@marcua marcua merged commit dbf47be into main Jul 2, 2021
@marcua marcua deleted the autostaff-load-hours-once branch July 2, 2021 00:55
@coveralls
Copy link

Coverage Status

Coverage increased (+0.001%) to 94.43% when pulling d4d687f on autostaff-load-hours-once into 0ce1ca7 on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants