示例#1
0
        public static void OnSuccess(Uri callbackUrl)
        {
            if (callbackUrl == null)
            {
                throw new ArgumentNullException("callbackUrl");
            }

            int dummy;

            _FailedCallbackLog.TryRemove(callbackUrl.Authority, out dummy);
        }
示例#2
0
        public void CancelTask(RevaleeTask task)
        {
            if (task == null)
            {
                throw new ArgumentNullException("task");
            }

            RevaleeTask awaitingTask;

            if (_AwaitingTaskCollection.TryGetValue(task.CallbackId, out awaitingTask))
            {
                if (awaitingTask.CallbackUrl.ToString().StartsWith(task.CallbackUrl.ToString(), StringComparison.OrdinalIgnoreCase))
                {
                    RevaleeTask removedTask;
                    bool        wasTaskRemoved = _AwaitingTaskCollection.TryRemove(awaitingTask.CallbackId, out removedTask);

                    lock (_SyncRoot)
                    {
                        _PersistenceProvider.RemoveTask(awaitingTask);
                    }

                    if (wasTaskRemoved)
                    {
                        Supervisor.Telemetry.DecrementAwaitingTasksValue();
                    }
                }
            }
            else
            {
                RevaleeTask storedTask = RetrieveTask(task.CallbackId);

                if (storedTask != null)
                {
                    if (storedTask.CallbackUrl.ToString().StartsWith(task.CallbackUrl.ToString(), StringComparison.OrdinalIgnoreCase))
                    {
                        lock (_SyncRoot)
                        {
                            _PersistenceProvider.RemoveTask(storedTask);
                        }
                    }
                }
            }
        }