|
|
@ -22,6 +22,7 @@ import (
|
|
|
|
adriver "github.com/arangodb/go-driver"
|
|
|
|
adriver "github.com/arangodb/go-driver"
|
|
|
|
ahttp "github.com/arangodb/go-driver/http"
|
|
|
|
ahttp "github.com/arangodb/go-driver/http"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
|
|
|
|
"github.com/labstack/echo/v4/middleware"
|
|
|
|
"github.com/twinj/uuid"
|
|
|
|
"github.com/twinj/uuid"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
@ -642,7 +643,7 @@ func (p *PoolMaster) CleanWORMTemp() (err error) {
|
|
|
|
defer p.lock.Unlock()
|
|
|
|
defer p.lock.Unlock()
|
|
|
|
|
|
|
|
|
|
|
|
for _, wormPool := range p.WORMPools {
|
|
|
|
for _, wormPool := range p.WORMPools {
|
|
|
|
if time.Since(wormPool.LastTouchy).Minutes() > 2 {
|
|
|
|
if time.Since(wormPool.LastTouchy).Minutes() > 1 {
|
|
|
|
wormPool.Unload()
|
|
|
|
wormPool.Unload()
|
|
|
|
delete(p.WORMPools, wormPool.PoolID)
|
|
|
|
delete(p.WORMPools, wormPool.PoolID)
|
|
|
|
os.RemoveAll(filepath.Join(poolMaster.cachePath, "worm", wormPool.PoolID))
|
|
|
|
os.RemoveAll(filepath.Join(poolMaster.cachePath, "worm", wormPool.PoolID))
|
|
|
@ -893,6 +894,9 @@ func main() {
|
|
|
|
// packResult.FileCount
|
|
|
|
// packResult.FileCount
|
|
|
|
}
|
|
|
|
}
|
|
|
|
e := echo.New()
|
|
|
|
e := echo.New()
|
|
|
|
|
|
|
|
e.Use(middleware.RecoverWithConfig(middleware.RecoverConfig{
|
|
|
|
|
|
|
|
StackSize: 1 << 10, // 1 KB
|
|
|
|
|
|
|
|
}))
|
|
|
|
//e.Use(middleware.Logger())
|
|
|
|
//e.Use(middleware.Logger())
|
|
|
|
|
|
|
|
|
|
|
|
e.GET("/", func(c echo.Context) error {
|
|
|
|
e.GET("/", func(c echo.Context) error {
|
|
|
@ -932,6 +936,21 @@ func main() {
|
|
|
|
exists := poolMaster.Lookup(id)
|
|
|
|
exists := poolMaster.Lookup(id)
|
|
|
|
if exists {
|
|
|
|
if exists {
|
|
|
|
fmt.Printf("/stash/%s exists already\n", id)
|
|
|
|
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")
|
|
|
|
return c.String(http.StatusAlreadyReported, "Exists already")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fmt.Printf("stashing %s", id)
|
|
|
|
fmt.Printf("stashing %s", id)
|
|
|
|