Handle price vs ctp inversion.

Handle cases where the adjusted price is lower than the cost to produce

Bug: 158300259
Test: N/A
Change-Id: I5f143849fd4fc1ed511c37e7cc98352b92350cb4
This commit is contained in:
Kweku Adams 2022-03-18 19:03:55 +00:00
parent f997596611
commit 43321f13b9

View File

@ -146,8 +146,11 @@ class ProcessStateModifier extends Modifier {
return 0;
case PROC_STATE_BUCKET_FGS:
// Can't get notification priority. Just use CTP for now.
return ctp;
return Math.min(ctp, price);
case PROC_STATE_BUCKET_BFGS:
if (price <= ctp) {
return price;
}
return (long) (ctp + .5 * (price - ctp));
case PROC_STATE_BUCKET_BG:
default: