mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
retrive the sms providers from the DB, and decrease the chosen provider's priority by 10, while increasing the other by 10. add a check in to ensure we never decrease below 0 or increase above 100 - this is per provider, we don't check that the two add up to 100 or anything. If the values are outside of this range (eg: set via the UI) then they'll probably* fix themselves at some point - we've added tests to document these cases. Use with_for_update to ensure that the method can only run once at a time - other invocations of the function will be held on that line until the currently running one ends and commits the transaction. This doesn't affect anyone doing things from the UI.