Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
e904d26e
authored
2013-09-11 16:23:41 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
modify middleware
1 parent
1ff0a31d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
61 deletions
middleware/error.go
middleware/profile.go
middleware/session.go
middleware/error.go
View file @
e904d26
...
...
@@ -257,7 +257,11 @@ func InternalServerError(rw http.ResponseWriter, r *http.Request) {
t
.
Execute
(
rw
,
data
)
}
func
registerErrorHander
()
{
func
Errorhandler
(
err
string
,
h
http
.
HandlerFunc
)
{
ErrorMaps
[
err
]
=
h
}
func
RegisterErrorHander
()
{
if
_
,
ok
:=
ErrorMaps
[
"404"
];
!
ok
{
ErrorMaps
[
"404"
]
=
NotFound
}
...
...
middleware/profile.go
View file @
e904d26
...
...
@@ -69,52 +69,6 @@ func DumpHeap() {
f
.
Close
()
}
//func showSystemStat(interval time.Duration, count int) {
// usage1 := &syscall.Rusage{}
// var lastUtime int64
// var lastStime int64
// counter := 0
// for {
// //http://man7.org/linux/man-pages/man3/vtimes.3.html
// syscall.Getrusage(syscall.RUSAGE_SELF, usage1)
// utime := (usage1.Utime.Sec * 1000000000) + int64(usage1.Utime.Usec)
// stime := (usage1.Stime.Sec * 1000000000) + int64(usage1.Stime.Usec)
// userCPUUtil := float64(utime-lastUtime) * 100 / float64(interval)
// sysCPUUtil := float64(stime-lastStime) * 100 / float64(interval)
// memUtil := usage1.Maxrss * 1024
// lastUtime = utime
// lastStime = stime
// if counter > 0 {
// fmt.Printf("cpu: %3.2f%% us %3.2f%% sy, mem:%s \n", userCPUUtil, sysCPUUtil, toH(uint64(memUtil)))
// }
// counter += 1
// if count >= 1 && count < counter {
// return
// }
// time.Sleep(interval)
// }
//}
//func ShowSystemStat(seconds int) {
// go func() {
// interval := time.Duration(seconds) * time.Second
// showSystemStat(interval, 0)
// }()
//}
//func PrintSystemStats() {
// interval := time.Duration(1) * time.Second
// showSystemStat(interval, 1)
//}
func
ShowGCStat
()
{
go
func
()
{
var
numGC
int64
...
...
middleware/session.go
deleted
100644 → 0
View file @
1ff0a31
package
middleware
import
(
"github.com/astaxie/beego/session"
)
var
(
GlobalSessions
*
session
.
Manager
)
func
StartSession
(
provideName
,
cookieName
string
,
maxlifetime
int64
,
savePath
string
)
{
GlobalSessions
,
_
=
session
.
NewManager
(
provideName
,
cookieName
,
maxlifetime
,
savePath
)
go
GlobalSessions
.
GC
()
}
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment