Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This cleans up a lot of the logic that was somewhat hard to follow, and had bugs such as dividing by 8 twice instead of once (so the number of nodes seemed wrong). The user feedback was also somewhat confusing, hopefully it is slightly less confusing.
There are still a few bugs such as the minimum duration seeming to be a bit wonky as when I request a minimum of 1 hour it seems that the backend purchased 2, but maybe that is expected from rounding (I would have to think about it more). More importantly, it seems to misuse the quoted price so that for example one runs
deno run prod up -d 1m -p 2.8
then it will quote the rest of the hour (fine), but then it will use that to determine the maximum price to pay for future hours (not fine). Also I remember the command working right away in the past, but it seems to have to wait for the 5 minute cron job now (maybe I am just misremembering, but this is definitely a lot more noticeable now that we supposedly have fast spin up times).Possibly the command should also just require the input duration to be explicitly in hours instead of quietly rounding up to the next hour increment.