File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,12 @@ package debug
3
3
import (
4
4
"net/http"
5
5
"runtime"
6
+
7
+ "github.com/gorilla/context"
6
8
)
7
9
8
10
func GC (w http.ResponseWriter , r * http.Request ) {
11
+ context .Purge (600 )
9
12
runtime .GC ()
10
13
w .WriteHeader (http .StatusNoContent )
11
14
}
Original file line number Diff line number Diff line change @@ -4,15 +4,16 @@ import (
4
4
"bytes"
5
5
"encoding/json"
6
6
"errors"
7
+ "net/http"
8
+ "strconv"
9
+ "time"
10
+
7
11
"github.com/gorilla/context"
8
12
"github.com/semaphoreui/semaphore/api/helpers"
9
13
"github.com/semaphoreui/semaphore/db"
10
14
"github.com/semaphoreui/semaphore/services/tasks"
11
15
"github.com/semaphoreui/semaphore/util"
12
16
log "github.com/sirupsen/logrus"
13
- "net/http"
14
- "strconv"
15
- "time"
16
17
)
17
18
18
19
// AddTask inserts a task into the database and returns a header or returns error
@@ -103,6 +104,7 @@ func GetTask(w http.ResponseWriter, r *http.Request) {
103
104
// GetTaskMiddleware is middleware that gets a task by id and sets the context to it or panics
104
105
func GetTaskMiddleware (next http.Handler ) http.Handler {
105
106
return http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
107
+ defer context .Clear (r )
106
108
project := context .Get (r , "project" ).(db.Project )
107
109
taskID , err := helpers .GetIntParam ("task_id" , w , r )
108
110
You can’t perform that action at this time.
0 commit comments