mirror of
https://github.com/elyby/chrly.git
synced 2024-11-17 02:32:59 +05:30
Resolves CHRLY-H. Add debug statement to investigate #28
This commit is contained in:
parent
60774b6b72
commit
3bf6872f3e
@ -9,6 +9,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/getsentry/raven-go"
|
||||
"github.com/mediocregopher/radix.v2/pool"
|
||||
"github.com/mediocregopher/radix.v2/redis"
|
||||
"github.com/mediocregopher/radix.v2/util"
|
||||
@ -204,6 +205,19 @@ func findMojangUuidByUsername(username string, conn util.Cmder) (string, bool, e
|
||||
|
||||
data, _ := response.Str()
|
||||
parts := strings.Split(data, ":")
|
||||
// Temporary debug statement to investigate https://github.com/elyby/chrly/issues/28
|
||||
if len(parts) < 2 {
|
||||
raven.Capture(raven.NewPacketWithExtra(
|
||||
"mojangUsernameToUuid hash contains corrupted data",
|
||||
raven.Extra{
|
||||
"rawValue": "hello world",
|
||||
"username": "this is username",
|
||||
},
|
||||
), map[string]string{})
|
||||
|
||||
return "", false, nil
|
||||
}
|
||||
|
||||
timestamp, _ := strconv.ParseInt(parts[1], 10, 64)
|
||||
storedAt := time.Unix(timestamp, 0)
|
||||
if storedAt.Add(time.Hour * 24 * 30).Before(now()) {
|
||||
|
@ -360,6 +360,7 @@ func (suite *redisTestSuite) TestGetUuid() {
|
||||
}
|
||||
|
||||
func (suite *redisTestSuite) TestStoreUuid() {
|
||||
suite.RunSubTest("store uuid", func() {
|
||||
now = func() time.Time {
|
||||
return time.Date(2020, 04, 21, 02, 10, 16, 0, time.UTC)
|
||||
}
|
||||
@ -371,6 +372,21 @@ func (suite *redisTestSuite) TestStoreUuid() {
|
||||
suite.Require().False(resp.IsType(redis.Nil))
|
||||
str, _ := resp.Str()
|
||||
suite.Require().Equal(str, "d3ca513eb3e14946b58047f2bd3530fd:1587435016")
|
||||
})
|
||||
|
||||
suite.RunSubTest("store empty uuid", func() {
|
||||
now = func() time.Time {
|
||||
return time.Date(2020, 04, 21, 02, 10, 16, 0, time.UTC)
|
||||
}
|
||||
|
||||
err := suite.Redis.StoreUuid("Mock", "")
|
||||
suite.Require().Nil(err)
|
||||
|
||||
resp := suite.cmd("HGET", "hash:mojang-username-to-uuid", "mock")
|
||||
suite.Require().False(resp.IsType(redis.Nil))
|
||||
str, _ := resp.Str()
|
||||
suite.Require().Equal(str, ":1587435016")
|
||||
})
|
||||
}
|
||||
|
||||
func (suite *redisTestSuite) TestPing() {
|
||||
|
Loading…
Reference in New Issue
Block a user