DataCache and changes for game update
Recent game update changed pokememes view in pokedeks, so we need to reflect it by updating parser. Introducing DataCache - a silver bullet for eliminating lags linked to database queries. Less queries, more in RAM, faster work. Needs testing in production environment.
This commit is contained in:
@@ -9,22 +9,25 @@ import (
|
||||
)
|
||||
|
||||
func (w *Welcomer) groupWelcomeUser(update *tgbotapi.Update, newUser *tgbotapi.User) string {
|
||||
playerRaw, ok := c.Users.GetOrCreatePlayer(newUser.ID)
|
||||
if !ok {
|
||||
playerRaw, err := c.DataCache.GetPlayerByTelegramID(newUser.ID)
|
||||
if err != nil {
|
||||
c.Log.Error(err.Error())
|
||||
return "fail"
|
||||
}
|
||||
|
||||
_, profileExist := c.Users.GetProfile(playerRaw.ID)
|
||||
_, profileExist := c.DataCache.GetProfileByPlayerID(playerRaw.ID)
|
||||
|
||||
message := "*Бот Инстинкта приветствует тебя, *"
|
||||
message += c.Users.GetPrettyName(newUser)
|
||||
message += "*!*\n\n"
|
||||
|
||||
if profileExist {
|
||||
if profileExist == nil {
|
||||
if playerRaw.LeagueID != 1 {
|
||||
w.alertSpyUser(update, newUser)
|
||||
}
|
||||
} else {
|
||||
c.Log.Info("Following profile error is OK.")
|
||||
c.Log.Info(err.Error())
|
||||
w.alertUserWithoutProfile(update, newUser)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user