Skip to content

Commit 3cdd6b0

Browse files
authored
Merge pull request #44 from chermehdi/bugfix/default_timelimit
Default the task time limit to 10000 if is 0
2 parents 5f259d0 + 9ab33d3 commit 3cdd6b0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

commands/parse.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ import (
55
"context"
66
json2 "encoding/json"
77
"fmt"
8-
. "github.com/chermehdi/egor/config"
9-
"github.com/chermehdi/egor/templates"
10-
"github.com/fatih/color"
11-
"github.com/urfave/cli/v2"
128
"io/ioutil"
139
"net/http"
1410
"os"
1511
"path"
1612
"strings"
1713
template2 "text/template"
1814
"time"
15+
16+
. "github.com/chermehdi/egor/config"
17+
"github.com/chermehdi/egor/templates"
18+
"github.com/fatih/color"
19+
"github.com/urfave/cli/v2"
1920
)
2021

2122
const listenAddr = ":4243"
@@ -100,6 +101,7 @@ func CreateDirectoryStructure(task Task, config Config, rootDir string) (string,
100101
// it will parse it as a json Task and return it.
101102
func extractTaskFromJson(json string) (*Task, error) {
102103
var task Task
104+
task.TimeLimit = 10000 // default timelimit to 10 seconds
103105
err := json2.Unmarshal([]byte(json), &task)
104106
if err != nil {
105107
return nil, err

commands/run.go

+1
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ func NewJudgeFor(meta config.EgorMeta, configuration *config.Config) (Judge, err
478478
case "java":
479479
return &JavaJudge{Meta: meta, checker: &DiffChecker{}}, nil
480480
case "cpp":
481+
return &CppJudge{Meta: meta, checker: &DiffChecker{}, hasLibrary: configuration.HasCppLibrary(), LibraryLocation: configuration.CppLibraryLocation}, nil
481482
case "c":
482483
return &CppJudge{Meta: meta, checker: &DiffChecker{}, hasLibrary: configuration.HasCppLibrary(), LibraryLocation: configuration.CppLibraryLocation}, nil
483484
case "python":

0 commit comments

Comments
 (0)