Unverified Commit 87189d12 authored by Xin.Zh's avatar Xin.Zh Committed by GitHub

Merge pull request #65 from georgehao/improve/delte-handleLoop

feat: go fmt
parents 78fbb15a 372309a4
...@@ -48,8 +48,10 @@ var ( ...@@ -48,8 +48,10 @@ var (
var taskPool gxsync.GenericTaskPool var taskPool gxsync.GenericTaskPool
const CronPeriod = 20e9 const (
const WritePkgTimeout = 1e8 CronPeriod = 20e9
WritePkgTimeout = 1e8
)
func main() { func main() {
flag.Parse() flag.Parse()
...@@ -80,9 +82,9 @@ func main() { ...@@ -80,9 +82,9 @@ func main() {
) )
var tmpSession getty.Session var tmpSession getty.Session
var NewHelloClientSession = func(session getty.Session) (err error) { NewHelloClientSession := func(session getty.Session) (err error) {
var pkgHandler = &PackageHandler{} pkgHandler := &PackageHandler{}
var EventListener = &MessageHandler{} EventListener := &MessageHandler{}
EventListener.SessionOnOpen = func(session getty.Session) { EventListener.SessionOnOpen = func(session getty.Session) {
tmpSession = session tmpSession = session
...@@ -173,7 +175,6 @@ func main() { ...@@ -173,7 +175,6 @@ func main() {
log.Printf("throughput (TPS) : %d\n", int64(n*m)*1000/totalT) log.Printf("throughput (TPS) : %d\n", int64(n*m)*1000/totalT)
log.Printf("mean: %.f ns, median: %.f ns, max: %.f ns, min: %.f ns, p99: %.f ns\n", mean, median, max, min, p99) log.Printf("mean: %.f ns, median: %.f ns, max: %.f ns, min: %.f ns, p99: %.f ns\n", mean, median, max, min, p99)
log.Printf("mean: %d ms, median: %d ms, max: %d ms, min: %d ms, p99: %d ms\n", int64(mean/1000000), int64(median/1000000), int64(max/1000000), int64(min/1000000), int64(p99/1000000)) log.Printf("mean: %d ms, median: %d ms, max: %d ms, min: %d ms, p99: %d ms\n", int64(mean/1000000), int64(median/1000000), int64(max/1000000), int64(min/1000000), int64(p99/1000000))
} }
type MessageHandler struct { type MessageHandler struct {
......
...@@ -45,8 +45,10 @@ var ( ...@@ -45,8 +45,10 @@ var (
var taskPool gxsync.GenericTaskPool var taskPool gxsync.GenericTaskPool
const CronPeriod = 20e9 const (
const WritePkgTimeout = 1e8 CronPeriod = 20e9
WritePkgTimeout = 1e8
)
func main() { func main() {
flag.Parse() flag.Parse()
...@@ -63,9 +65,9 @@ func main() { ...@@ -63,9 +65,9 @@ func main() {
) )
var tmpSession getty.Session var tmpSession getty.Session
var NewHelloClientSession = func(session getty.Session) (err error) { NewHelloClientSession := func(session getty.Session) (err error) {
var pkgHandler = &PackageHandler{} pkgHandler := &PackageHandler{}
var EventListener = &MessageHandler{} EventListener := &MessageHandler{}
EventListener.SessionOnOpen = func(session getty.Session) { EventListener.SessionOnOpen = func(session getty.Session) {
tmpSession = session tmpSession = session
......
...@@ -43,9 +43,7 @@ var ( ...@@ -43,9 +43,7 @@ var (
pprofPort = flag.Int("pprof_port", 65432, "pprof http port") pprofPort = flag.Int("pprof_port", 65432, "pprof http port")
) )
var ( var taskPool gxsync.GenericTaskPool
taskPool gxsync.GenericTaskPool
)
const CronPeriod = 20e9 const CronPeriod = 20e9
...@@ -75,8 +73,8 @@ func main() { ...@@ -75,8 +73,8 @@ func main() {
} }
func NewHelloServerSession(session getty.Session) (err error) { func NewHelloServerSession(session getty.Session) (err error) {
var pkgHandler = &PackageHandler{} pkgHandler := &PackageHandler{}
var EventListener = &MessageHandler{} EventListener := &MessageHandler{}
tcpConn, ok := session.Conn().(*net.TCPConn) tcpConn, ok := session.Conn().(*net.TCPConn)
if !ok { if !ok {
......
...@@ -34,17 +34,13 @@ import ( ...@@ -34,17 +34,13 @@ import (
uatomic "go.uber.org/atomic" uatomic "go.uber.org/atomic"
) )
var ( var launchTime = time.Now()
launchTime = time.Now()
)
///////////////////////////////////////// /////////////////////////////////////////
// getty connection // getty connection
///////////////////////////////////////// /////////////////////////////////////////
var ( var connID uatomic.Uint32
connID uatomic.Uint32
)
type gettyConn struct { type gettyConn struct {
id uint32 id uint32
......
...@@ -58,9 +58,7 @@ const ( ...@@ -58,9 +58,7 @@ const (
// session // session
///////////////////////////////////////// /////////////////////////////////////////
var ( var defaultTimerWheel *gxtime.TimerWheel
defaultTimerWheel *gxtime.TimerWheel
)
func init() { func init() {
gxtime.InitDefaultTimerWheel() gxtime.InitDefaultTimerWheel()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment