@@ -5,6 +5,9 @@ namespace Tingle.Dependabot.Models.Management;
5
5
6
6
public class UpdateJobResources
7
7
{
8
+ // the minimum is 0.25vCPU and 0.5GB but we need more because a lot is happening in the container
9
+ private static readonly UpdateJobResources Default = new ( cpu : 0.5 , memory : 1 ) ;
10
+
8
11
public UpdateJobResources ( ) { } // required for deserialization
9
12
10
13
public UpdateJobResources ( double cpu , double memory )
@@ -33,14 +36,16 @@ public static UpdateJobResources FromEcosystem(string ecosystem)
33
36
{
34
37
return ecosystem switch
35
38
{
36
- "npm" => new ( cpu : 1 , memory : 2 ) ,
37
- "yarn" => new ( cpu : 1 , memory : 2 ) ,
38
- "pnpm" => new ( cpu : 1 , memory : 2 ) ,
39
- "terraform" => new ( cpu : 0.5 , memory : 1 ) ,
40
- _ => new ( cpu : 0.25 , memory : 0.5 ) , // the minimum
39
+ "npm" => Default * 2 ,
40
+ "yarn" => Default * 2 ,
41
+ "pnpm" => Default * 2 ,
42
+ _ => Default ,
41
43
} ;
42
44
}
43
45
46
+ public static UpdateJobResources operator * ( UpdateJobResources resources , double factor ) => new ( resources . Cpu * factor , resources . Memory * factor ) ;
47
+ public static UpdateJobResources operator / ( UpdateJobResources resources , double factor ) => new ( resources . Cpu / factor , resources . Memory / factor ) ;
48
+
44
49
public static implicit operator AppContainerResources ( UpdateJobResources resources )
45
50
{
46
51
return new ( ) { Cpu = resources . Cpu , Memory = $ "{ resources . Memory } Gi", } ;
0 commit comments