Skip to content

Commit 6391ec8

Browse files
committed
Set default default timelimit to 10 seconds
1 parent 0acfeab commit 6391ec8

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
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

config/meta.go

-3
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ func NewEgorMeta(task Task, config Config) EgorMeta {
7575
if err != nil {
7676
panic(err)
7777
}
78-
if task.TimeLimit == 0 {
79-
task.TimeLimit = 10000
80-
}
8178
return EgorMeta{
8279
TaskName: task.Name,
8380
TaskLang: config.Lang.Default,

0 commit comments

Comments
 (0)