Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
e904d26e
Commit
e904d26e
authored
Sep 11, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify middleware
parent
1ff0a31d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
61 deletions
+5
-61
error.go
middleware/error.go
+5
-1
profile.go
middleware/profile.go
+0
-46
session.go
middleware/session.go
+0
-14
No files found.
middleware/error.go
View file @
e904d26e
...
...
@@ -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 @
e904d26e
...
...
@@ -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 @
1ff0a31d
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
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment