From 561a9d260b970ad8f54620870009a340d3022f61 Mon Sep 17 00:00:00 2001 From: hantmac Date: Sat, 24 Aug 2019 15:50:53 +0800 Subject: [PATCH 1/3] remove redundant code --- backend/database/pubsub.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/backend/database/pubsub.go b/backend/database/pubsub.go index 27b10687..b100535f 100644 --- a/backend/database/pubsub.go +++ b/backend/database/pubsub.go @@ -32,6 +32,7 @@ func (c *Subscriber) Connect() { log.Debug("wait...") switch res := c.client.Receive().(type) { case redis.Message: + i = 0 channel := (*string)(unsafe.Pointer(&res.Channel)) message := (*string)(unsafe.Pointer(&res.Data)) c.cbMap[*channel](*channel, *message) @@ -39,17 +40,17 @@ func (c *Subscriber) Connect() { fmt.Printf("%s: %s %d\n", res.Channel, res.Kind, res.Count) case error: log.Error("error handle redis connection...") - con, err := GetRedisConn() - if err != nil { - log.Fatal("redis dial failed") - continue - } - c.client = redis.PubSubConn{Conn: con} - c.cbMap = make(map[string]SubscribeCallback) + time.Sleep(2 * time.Second) if i > 5 { panic(errors.New("redis connection failed too many times, panic")) } + con, err := GetRedisConn() + if err != nil { + log.Error("redis dial failed") + continue + } + c.client = redis.PubSubConn{Conn: con} i += 1 continue From f6069a74fa255ec99a929e51465ace7db183fe24 Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Sat, 24 Aug 2019 16:56:08 +0800 Subject: [PATCH 2/3] added language switch on login page --- frontend/src/assets/logo.svg | 14 +++++++ frontend/src/i18n/zh.js | 1 + .../src/views/layout/components/Navbar.vue | 2 +- frontend/src/views/login/index.vue | 38 ++++++++++++++++++- 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 frontend/src/assets/logo.svg diff --git a/frontend/src/assets/logo.svg b/frontend/src/assets/logo.svg new file mode 100644 index 00000000..b0e23910 --- /dev/null +++ b/frontend/src/assets/logo.svg @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/frontend/src/i18n/zh.js b/frontend/src/i18n/zh.js index c8573bd4..b1de3b47 100644 --- a/frontend/src/i18n/zh.js +++ b/frontend/src/i18n/zh.js @@ -214,6 +214,7 @@ export default { // 下拉框 User: '用户', Logout: '退出登录', + Documentation: '文档', // 选择 'Yes': '是', diff --git a/frontend/src/views/layout/components/Navbar.vue b/frontend/src/views/layout/components/Navbar.vue index 976d98d9..f60c0051 100644 --- a/frontend/src/views/layout/components/Navbar.vue +++ b/frontend/src/views/layout/components/Navbar.vue @@ -30,7 +30,7 @@ - 文档 + {{$t('Documentation')}} diff --git a/frontend/src/views/login/index.vue b/frontend/src/views/login/index.vue index 195ae1de..a21c0f42 100644 --- a/frontend/src/views/login/index.vue +++ b/frontend/src/views/login/index.vue @@ -4,7 +4,7 @@