Skip to content

Commit

Permalink
improvement: set startDate to 3 hours ago to minimize missing price data
Browse files Browse the repository at this point in the history
  • Loading branch information
hoonoh committed Oct 15, 2019
1 parent 3644906 commit ca03be4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ const getEc2SpotPrice = async (options: {
});

const fetch = async (nextToken?: string): Promise<EC2.SpotPrice[]> => {
const startTime = new Date();
startTime.setHours(startTime.getHours() - 3);
const result = await ec2
.describeSpotPriceHistory({
NextToken: nextToken,
StartTime: new Date(),
StartTime: startTime,
ProductDescriptions: productDescriptions,
InstanceTypes: instanceTypes,
})
Expand Down

0 comments on commit ca03be4

Please sign in to comment.