mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2024-04-21 12:32:08 +00:00
improve (profiling): create a flag to enable profiling
This commit is contained in:
@@ -173,21 +173,21 @@ export const onUpload = function(path, e){
|
||||
</h2>
|
||||
<div className="stats_content">
|
||||
{
|
||||
currents.map((process, i) => {
|
||||
currents.slice(0, 1000).map((process, i) => {
|
||||
return (
|
||||
<div onClick={() => this.emphasis(process.path)} className="current_color" key={i}>{process.path.replace(/\//, '')}</div>
|
||||
);
|
||||
})
|
||||
}
|
||||
{
|
||||
processes.slice(0, 2000).map((process, i) => {
|
||||
processes.slice(0, 1000).map((process, i) => {
|
||||
return (
|
||||
<div onClick={() => this.emphasis(process.path)} className="todo_color" key={i}>{process.path.replace(/\//, '')}</div>
|
||||
);
|
||||
})
|
||||
}
|
||||
{
|
||||
failed.slice(0, 200).map((process, i) => {
|
||||
failed.slice(0, 500).map((process, i) => {
|
||||
return (
|
||||
<div onClick={() => this.emphasis(process.path)} className="error_color" key={i}>{process.path}</div>
|
||||
);
|
||||
|
||||
+17
-1
@@ -7,6 +7,8 @@ import (
|
||||
. "github.com/mickael-kerjean/nuage/server/middleware"
|
||||
_ "github.com/mickael-kerjean/nuage/server/plugin"
|
||||
"net/http"
|
||||
"net/http/pprof"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@@ -20,6 +22,20 @@ func main() {
|
||||
func Init(a *App) {
|
||||
r := mux.NewRouter()
|
||||
|
||||
// Profiling - handy to indentify nasty leaks and/or bugs!
|
||||
if os.Getenv("DEBUG") == "true" {
|
||||
r.HandleFunc("/debug/pprof/", pprof.Index)
|
||||
r.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
|
||||
r.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
||||
r.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
|
||||
r.HandleFunc("/debug/pprof/trace", pprof.Trace)
|
||||
r.Handle("/debug/pprof/goroutine", pprof.Handler("goroutine"))
|
||||
r.Handle("/debug/pprof/heap", pprof.Handler("heap"))
|
||||
r.Handle("/debug/pprof/threadcreate", pprof.Handler("threadcreate"))
|
||||
r.Handle("/debug/pprof/block", pprof.Handler("block"))
|
||||
r.Handle("/debug/pprof/heap", pprof.Handler("heap"))
|
||||
}
|
||||
|
||||
// API
|
||||
session := r.PathPrefix("/api/session").Subrouter()
|
||||
session.HandleFunc("", APIHandler(SessionGet, *a)).Methods("GET")
|
||||
@@ -44,7 +60,7 @@ func Init(a *App) {
|
||||
|
||||
// WEBDAV
|
||||
r.PathPrefix("/s/{share}").Handler(CtxInjector(WebdavHandler, *a))
|
||||
|
||||
|
||||
// APP
|
||||
r.HandleFunc("/api/config", CtxInjector(ConfigHandler, *a)).Methods("GET")
|
||||
r.PathPrefix("/assets").Handler(StaticHandler(FILE_ASSETS, *a)).Methods("GET")
|
||||
|
||||
Reference in New Issue
Block a user