protected override void DoAfterCompleteContext(RedisBufferContext context, RedisAsyncTask asyncTask)
        {
            if (context.ResultType == RedisRawObjectType.Array)
            {
                var result = context.Result as RedisArray;

                if (!ReferenceEquals(result, null))
                {
                    var message = ToPubSubMessage(result);

                    if (message != null && !message.IsEmpty)
                    {
                        if (asyncTask != null &&
                            !(message.Type == RedisPubSubMessageType.Message ||
                              message.Type == RedisPubSubMessageType.PMessage))
                        {
                            asyncTask.TrySetCompleted(context.Result);
                        }

                        var callback = m_Callback;
                        if (callback != null)
                        {
                            callback(message);
                        }
                        return;
                    }
                }
            }

            if (asyncTask != null)
            {
                asyncTask.TrySetCompleted(context.Result);
            }
        }
Exemple #2
0
        protected override void DoAfterCompleteContext(RedisBufferContext context, RedisAsyncTask asyncTask)
        {
            if (context.ResultType == RedisRawObjectType.SimpleString)
            {
                var result = context.Result as RedisString;

                if (!ReferenceEquals(result, null) &&
                    result != RedisConstants.OK)
                {
                    var message = ToMonitorMessage(result);
                    if (message != null && !message.IsEmpty)
                    {
                        var callback = m_Callback;
                        if (callback != null)
                        {
                            callback(message);
                        }
                        return;
                    }
                }
            }

            if (asyncTask != null)
            {
                asyncTask.TrySetCompleted(context.Result);
            }
        }
 protected virtual void DoAfterCompleteContext(RedisBufferContext context, RedisAsyncTask asyncTask)
 {
     if (asyncTask != null)
     {
         asyncTask.TrySetCompleted(context.Result);
     }
 }