7
7
import { CostCenterDB } from "@gitpod/gitpod-db/lib" ;
8
8
import { User } from "@gitpod/gitpod-protocol" ;
9
9
import { AttributionId } from "@gitpod/gitpod-protocol/lib/attribution" ;
10
- import { ConfigCatClientFactory } from "@gitpod/gitpod-protocol/lib/experiments/configcat-server" ;
11
10
import { log } from "@gitpod/gitpod-protocol/lib/util/logging" ;
12
11
import { GetUpcomingInvoiceResponse } from "@gitpod/usage-api/lib/usage/v1/billing_pb" ;
13
12
import {
@@ -31,7 +30,6 @@ export class BillingService {
31
30
protected readonly usageServiceClientProvider : CachingUsageServiceClientProvider ;
32
31
@inject ( CachingBillingServiceClientProvider )
33
32
protected readonly billingServiceClientProvider : CachingBillingServiceClientProvider ;
34
- @inject ( ConfigCatClientFactory ) protected readonly configCatClientFactory : ConfigCatClientFactory ;
35
33
36
34
async checkSpendingLimitReached ( user : User ) : Promise < SpendingLimitReachedResult > {
37
35
const attributionId = await this . userService . getWorkspaceUsageAttributionId ( user ) ;
@@ -46,13 +44,6 @@ export class BillingService {
46
44
} ;
47
45
}
48
46
49
- if ( ! ( await this . isSpendingLimitCheckEnabled ( user ) ) ) {
50
- return {
51
- reached : false ,
52
- attributionId,
53
- } ;
54
- }
55
-
56
47
const upcomingInvoice = await this . getUpcomingInvoice ( attributionId ) ;
57
48
const currentUsage = upcomingInvoice . getCredits ( ) ;
58
49
if ( currentUsage >= costCenter . spendingLimit ) {
@@ -84,13 +75,6 @@ export class BillingService {
84
75
} ;
85
76
}
86
77
87
- protected async isSpendingLimitCheckEnabled ( user : User ) : Promise < boolean > {
88
- // introducing this enablement flag to be able to explicitly control the spending limit check during rollout
89
- return await this . configCatClientFactory ( ) . getValueAsync ( "isSpendingLimitCheckEnabled" , false , {
90
- user : user ,
91
- } ) ;
92
- }
93
-
94
78
async getUpcomingInvoice ( attributionId : AttributionId ) : Promise < GetUpcomingInvoiceResponse > {
95
79
const response = await this . billingServiceClientProvider . getDefault ( ) . getUpcomingInvoice ( attributionId ) ;
96
80
return response ;
0 commit comments