Skip to content

Commit

Permalink
Bump dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
IceeMC committed Aug 12, 2020
1 parent 85f53fa commit 55b1218
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 36 deletions.
6 changes: 3 additions & 3 deletions database/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package database
import (
"context"
"fmt"
"github.com/go-redis/redis/v7"
"github.com/go-redis/redis/v8"
log "github.com/sirupsen/logrus"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
Expand All @@ -27,7 +27,7 @@ func NewManager() Manager {
}

func (manager *Manager) IsRedisOpen() bool {
if err := manager.Redis.Ping().Err(); err != nil {
if err := manager.Redis.Ping(context.Background()).Err(); err != nil {
return false
}
return true
Expand All @@ -52,7 +52,7 @@ func (manager *Manager) retryRedisConnect() {
if backoff.Seconds() >= 30 {
backoff = 1 * time.Second
}
if err := manager.Redis.Ping().Err(); err != nil {
if err := manager.Redis.Ping(context.Background()).Err(); err != nil {
log.WithField("type", "Redis").Warnf("Retry attempt %d failed!", attempt)
} else {
log.WithField("type", "Redis").Infof("Connected on attempt %d!", attempt)
Expand Down
4 changes: 2 additions & 2 deletions entities/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func mongoLookupBot(id string) (error, *Bot) {
}

func LookupBot(id string, clean bool) (error, *Bot) {
redisBot, err := util.Database.Redis.HGet("bots", id).Result()
redisBot, err := util.Database.Redis.HGet(context.TODO(), "bots", id).Result()
if err != nil {
if redisBot == "" {
err, bot := mongoLookupBot(id)
Expand Down Expand Up @@ -131,7 +131,7 @@ func LookupBot(id string, clean bool) (error, *Bot) {
}

func GetAllBots(clean bool) (error, []Bot) {
redisBots, err := util.Database.Redis.HVals("bots").Result()
redisBots, err := util.Database.Redis.HVals(context.TODO(), "bots").Result()
if err != nil && len(redisBots) > 0 {
actual := make([]Bot, len(redisBots))
for _, str := range redisBots {
Expand Down
4 changes: 2 additions & 2 deletions entities/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func mongoLookupServer(id string) (error, *Server) {
}

func LookupServer(id string, clean bool) (error, *Server) {
redisServer, err := util.Database.Redis.HGet("servers", id).Result()
redisServer, err := util.Database.Redis.HGet(context.TODO(), "servers", id).Result()
if err != nil {
if redisServer == "" {
err, server := mongoLookupServer(id)
Expand Down Expand Up @@ -97,7 +97,7 @@ func LookupServer(id string, clean bool) (error, *Server) {
}

func GetAllServers(clean bool) (error, []Server) {
redisServers, err := util.Database.Redis.HVals("servers").Result()
redisServers, err := util.Database.Redis.HVals(context.TODO(), "servers").Result()
if err != nil && len(redisServers) > 0 {
actual := make([]Server, len(redisServers))
for _, str := range redisServers {
Expand Down
4 changes: 2 additions & 2 deletions entities/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func mongoLookupTemplate(id string) (error, *ServerTemplate) {
}

func LookupTemplate(id string) (error, *ServerTemplate) {
redisTemplate, err := util.Database.Redis.HGet("templates", id).Result()
redisTemplate, err := util.Database.Redis.HGet(context.TODO(), "templates", id).Result()
if err != nil {
if redisTemplate == "" {
err, template := mongoLookupTemplate(id)
Expand Down Expand Up @@ -114,7 +114,7 @@ func LookupTemplate(id string) (error, *ServerTemplate) {
}

func GetAllTemplates() (error, []ServerTemplate) {
redisTemplates, err := util.Database.Redis.HVals("templates").Result()
redisTemplates, err := util.Database.Redis.HVals(context.TODO(), "templates").Result()
if err != nil && len(redisTemplates) > 0 {
actual := make([]ServerTemplate, len(redisTemplates))
for _, str := range redisTemplates {
Expand Down
4 changes: 2 additions & 2 deletions entities/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func mongoLookupUser(id string) (error, *User) {
}

func LookupUser(id string, clean bool) (error, *User) {
redisUser, err := util.Database.Redis.HGet("users", id).Result()
redisUser, err := util.Database.Redis.HGet(context.TODO(), "users", id).Result()
if err != nil {
if redisUser == "" {
err, user := mongoLookupUser(id)
Expand Down Expand Up @@ -178,7 +178,7 @@ func LookupUser(id string, clean bool) (error, *User) {
}

func GetAllUsers(clean bool) (error, []User) {
redisUsers, err := util.Database.Redis.HVals("users").Result()
redisUsers, err := util.Database.Redis.HVals(context.TODO(), "users").Result()
if err != nil && len(redisUsers) > 0 {
actual := make([]User, len(redisUsers))
for _, str := range redisUsers {
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ module github.com/discordextremelist/api
go 1.14

require (
github.com/go-chi/chi v4.1.1+incompatible
github.com/go-redis/redis/v7 v7.2.0
github.com/golang/protobuf v1.4.0 // indirect
github.com/go-chi/chi v4.1.2+incompatible
github.com/go-redis/redis/v8 v8.0.0-beta.7
github.com/joho/godotenv v1.3.0
github.com/json-iterator/go v1.1.9
github.com/json-iterator/go v1.1.10
github.com/klauspost/compress v1.10.5 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/sirupsen/logrus v1.5.0
github.com/stretchr/testify v1.4.0 // indirect
go.mongodb.org/mongo-driver v1.3.2
github.com/sirupsen/logrus v1.6.0
go.mongodb.org/mongo-driver v1.4.0
go.opentelemetry.io/otel v0.10.0 // indirect
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 // indirect
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed // indirect
google.golang.org/grpc v1.31.0 // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
)
Loading

0 comments on commit 55b1218

Please sign in to comment.