Skip to content

Commit

Permalink
Merge pull request #788 from forta-network/caner/forta-1085-manual-bo…
Browse files Browse the repository at this point in the history
…t-memory-configuration-results-in-wrong-amount

Fix memory configuration zeroes
  • Loading branch information
canercidam authored Jul 11, 2023
2 parents 7f92f4c + 5679c0f commit d0c2040
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions config/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func CPUsToMicroseconds(cpus float64) int64 {

// MiBToBytes converts given MiB amount to bytes.
func MiBToBytes(mib int) int64 {
return int64(mib * 104858)
return int64(mib * 1048580)
}

// getDefaultCPUQuotaPerAgent returns the default CFS microseconds value allowed per agent
Expand All @@ -45,5 +45,5 @@ func getDefaultCPUQuotaPerAgent() int64 {

// getDefaultMemoryPerAgent returns the constant default memory allowed per agent.
func getDefaultMemoryPerAgent() int64 {
return MiBToBytes(10000)
return MiBToBytes(1e3)
}
2 changes: 1 addition & 1 deletion config/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func TestGetAgentResourceLimits(t *testing.T) {

limits := GetAgentResourceLimits(ResourcesConfig{})
r.Equal(CPUsToMicroseconds(0.2), limits.CPUQuota)
r.Equal(MiBToBytes(10000), limits.Memory)
r.Equal(MiBToBytes(1000), limits.Memory)
}

func TestGetAgentResourceLimits_CustomValues(t *testing.T) {
Expand Down

0 comments on commit d0c2040

Please sign in to comment.