There's a test event loop in host module. Integrate a next bill time to this loop. When a metering record is done we should update the cache/config with a next bill time based on billing period. This Next bill time is used in the event loop to determine when it's time to bill again. If we are on or past the time we meter a bill.
Note that we may have two different types of "billings". We could call one metering and one billing:
We need to meter hourly per csp terms. However if the billing period is longer than hourly such as monthly we meter usage of 0 every hour.
The billing happens based on billing period. At a monthly rate we will actually bill usage once a month and we will multiply that by a factor of 720 for a standard nodes/hour charge every month.
There's a test event loop in host module. Integrate a next bill time to this loop. When a metering record is done we should update the cache/config with a next bill time based on billing period. This Next bill time is used in the event loop to determine when it's time to bill again. If we are on or past the time we meter a bill.
https://github.com/SUSE-Enceladus/csp-billing-adapter/blob/devel/csp_billing_adapter/host.py