Fix capitalization of Serve->SERVE, fix double cache export
This commit is contained in:
parent
1b84606232
commit
c11ddae546
12
cmd/cache.go
12
cmd/cache.go
|
@ -72,6 +72,12 @@ func (cache *fileCache) set(val []string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (cache *fileCache) clear() {
|
||||
cache.mutex.Lock()
|
||||
cache.list = nil
|
||||
cache.mutex.Unlock()
|
||||
}
|
||||
|
||||
func (cache *fileCache) isEmpty() bool {
|
||||
cache.mutex.RLock()
|
||||
length := len(cache.list)
|
||||
|
@ -152,15 +158,15 @@ func (cache *fileCache) Import(path string) error {
|
|||
|
||||
func serveCacheClear(args []string, cache *fileCache, formats *types.Types, errorChannel chan<- error) httprouter.Handle {
|
||||
return func(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
|
||||
list, err := fileList(args, &filters{}, "", &fileCache{}, formats)
|
||||
cache.clear()
|
||||
|
||||
_, err := fileList(args, &filters{}, "", cache, formats)
|
||||
if err != nil {
|
||||
errorChannel <- err
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
cache.set(list)
|
||||
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
|
||||
w.Write([]byte("Ok"))
|
||||
|
|
|
@ -123,7 +123,7 @@ func serveIndexHtml(args []string, cache *fileCache, paginate bool) httprouter.H
|
|||
}
|
||||
|
||||
if Verbose {
|
||||
fmt.Printf("%s | Serve: HTML index page (%s) to %s in %s\n",
|
||||
fmt.Printf("%s | SERVE: HTML index page (%s) to %s in %s\n",
|
||||
startTime.Format(logDate),
|
||||
humanReadableSize(b),
|
||||
realIP(r),
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
ReleaseVersion string = "0.96.3"
|
||||
ReleaseVersion string = "0.96.4"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
Loading…
Reference in New Issue