Exemple #1
0
        public string CreateChat(CreateChatModel model)
        {
            try
            {
                var response = _backend.CreateChat(WorkerContext, model);
                if (response.Success)
                {
                    var chatId = response.Body;
                    foreach (var user in model.Users)
                    {
                        AddToChat(user, chatId);
                    }

                    Logger.Debug(LogKey + model);
                    return(chatId);
                }

                Logger.Warn(response + LogKey + model);
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
            return(null);
        }
Exemple #2
0
        public ResponseModel <string> CreateChat(IWorkerContext context, CreateChatModel model)
        {
            var response = _backend.CreateChat(context, model);

            if (response.Success)
            {
                foreach (var userId in model.Users)
                {
                    var key = GetChatKey(userId);
                    _cache.Remove(key);
                }
            }

            return(response);
        }
Exemple #3
0
        public ResponseModel <string> CreateChat(IWorkerContext context, CreateChatModel model)
        {
            var response = _backend.CreateChat(context, model);

            if (response.Success)
            {
                foreach (var userId in model.Users)
                {
                    var key = Pref("GetChats_" + userId);
                    _redis.GetDatabase().KeyDelete(key, CommandFlags.FireAndForget);
                }
            }

            return(response);
        }