File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -239,8 +239,12 @@ func (s *WebServer) handleStart(w http.ResponseWriter, r *http.Request) {
239239 cfg .RawInjector .CollectionName = coln
240240 }
241241
242+ var uploadedTempDir string
243+
242244 if ! cfg .DefaultWorkload {
243245 tempDir , _ := os .MkdirTemp ("" , "plgm-ui-workload-*" )
246+ uploadedTempDir = tempDir
247+
244248 collFile , _ , err := r .FormFile ("collections_file" )
245249 if err == nil {
246250 defer collFile .Close ()
@@ -325,6 +329,11 @@ func (s *WebServer) handleStart(w http.ResponseWriter, r *http.Request) {
325329 json .NewEncoder (w ).Encode (map [string ]string {"status" : "started" })
326330
327331 go func () {
332+ defer func () {
333+ if uploadedTempDir != "" {
334+ os .RemoveAll (uploadedTempDir )
335+ }
336+ }()
328337 defer benchConn .Disconnect (context .Background ())
329338 defer func () {
330339 s .mu .Lock ()
@@ -439,6 +448,11 @@ func (s *WebServer) handleStart(w http.ResponseWriter, r *http.Request) {
439448 json .NewEncoder (w ).Encode (map [string ]string {"status" : "started" })
440449
441450 go func () {
451+ defer func () {
452+ if uploadedTempDir != "" {
453+ os .RemoveAll (uploadedTempDir )
454+ }
455+ }()
442456 defer benchConn .Disconnect (context .Background ())
443457 defer func () {
444458 s .mu .Lock ()
You can’t perform that action at this time.
0 commit comments