Add mechanism to mark simulations as charged to avoid charging more than once
Related tasks
Context
Whenever cloudsim fails to tear a simulation down, sysadmins usually request a manual termination of that simulation to go over the stop simulation action once more. The problem is that users are being charged more than once when that request is processed, dealing to duplicated charges.
Change
This MR adds a ChargedAt
field to keep track when a simulation has been charged. This only applies to simulations that is being processed in the stop simulation action, and not in any rollback handler.
Other information
Choosing ChargedAt
over PriceCharged
because ChargedAt
required less work to be implemented. PriceCharged
require us to update a simulation in the SubtractCredits
, making the Billing
service depend on the Simulations
service.