diff --git a/storageserver/storageserver.go b/storageserver/storageserver.go index 65e98c4..4cbf18a 100644 --- a/storageserver/storageserver.go +++ b/storageserver/storageserver.go @@ -22,6 +22,7 @@ import ( adriver "github.com/arangodb/go-driver" ahttp "github.com/arangodb/go-driver/http" "github.com/labstack/echo/v4" + "github.com/labstack/echo/v4/middleware" "github.com/twinj/uuid" ) @@ -642,7 +643,7 @@ func (p *PoolMaster) CleanWORMTemp() (err error) { defer p.lock.Unlock() for _, wormPool := range p.WORMPools { - if time.Since(wormPool.LastTouchy).Minutes() > 2 { + if time.Since(wormPool.LastTouchy).Minutes() > 1 { wormPool.Unload() delete(p.WORMPools, wormPool.PoolID) os.RemoveAll(filepath.Join(poolMaster.cachePath, "worm", wormPool.PoolID)) @@ -893,6 +894,9 @@ func main() { // packResult.FileCount } e := echo.New() + e.Use(middleware.RecoverWithConfig(middleware.RecoverConfig{ + StackSize: 1 << 10, // 1 KB + })) //e.Use(middleware.Logger()) e.GET("/", func(c echo.Context) error { @@ -932,6 +936,21 @@ func main() { exists := poolMaster.Lookup(id) if exists { fmt.Printf("/stash/%s exists already\n", id) + file, err := c.FormFile("file") + if err != nil { + fmt.Println(err) + return c.String(http.StatusExpectationFailed, "Error") + } + formStream, err := file.Open() + if err != nil { + fmt.Println(err) + return c.String(http.StatusExpectationFailed, "Error") + } + defer formStream.Close() + if _, err = io.Copy(io.Discard, formStream); err != nil { + fmt.Println(err) + return c.String(http.StatusExpectationFailed, "Error") + } return c.String(http.StatusAlreadyReported, "Exists already") } fmt.Printf("stashing %s", id)