Skip to content

Commit

Permalink
Add clock limit
Browse files Browse the repository at this point in the history
  • Loading branch information
ajami1331 committed Jan 26, 2024
1 parent 55f2394 commit ca282b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sojj/Dtos/SandboxRunRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class Command
[JsonPropertyName("files")]
public SandboxFile[]? Files { get; set; }

[JsonPropertyName("clockLimit")]
public long? ClockLimit { get; set; }

[JsonPropertyName("cpuLimit")]
public long? CpuLimit { get; set; }

Expand Down
2 changes: 2 additions & 0 deletions sojj/Services/SandBoxService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public async Task<CompileResult> CompileAsync(string sourceCode, string runId, s
},
],
CpuLimit = this.cpuLimitForRuns * Constants.NanoSecondInSecond,
ClockLimit = (this.cpuLimitForRuns * Constants.NanoSecondInSecond) * 3,
MemoryLimit = this.memoryLimitForRuns * Constants.ByteInMegaByte,
ProcessLimit = this.processLimitForRuns,
CopyIn = new Dictionary<string, SandboxFile>
Expand Down Expand Up @@ -225,6 +226,7 @@ public async Task<TestCaseResult> RunAsync(TestCase testCase, CompileResult comp
},
],
CpuLimit = testCase.TimeLimit,
ClockLimit = testCase.TimeLimit * 3,
MemoryLimit = testCase.MemoryLimit,
ProcessLimit = this.processLimitForRuns,
CopyIn = copyIn,
Expand Down

0 comments on commit ca282b0

Please sign in to comment.