private void SetStatus(LongOperationStatus newStatus)
 {
     AppendHistoryLine("SetStatus", ">");
     AppendHistoryLine("SetStatus", "newStatus=" + newStatus);
     this.status = newStatus;
     AppendHistoryLine("SetStatus", "<");
 }
Beispiel #2
0
        public static void ProcessLongOperationStatus(LongOperationStatus longOperationStatus, IRedisClient redisClient, IServerEvents serverEvents)
        {
            var hashId     = string.Concat("LongOperationStatus:", longOperationStatus.ProcessKey.Split('!')[0], ":", longOperationStatus.TenantId);
            var setId      = string.Concat("LongOperationStatus:Keys:", longOperationStatus.ProcessKey.Split('!')[0], ":", longOperationStatus.TenantId);
            var processKey = string.Concat(longOperationStatus.UserId, "!", longOperationStatus.ProcessKey);

            redisClient.SetEntryInHash(hashId, processKey, longOperationStatus.ToJson());
            redisClient.AddItemToSortedSet(setId, processKey, longOperationStatus.Changed);
            redisClient.AddItemToSortedSet(string.Concat(setId, ":", longOperationStatus.UserId), processKey, longOperationStatus.Changed);

            var keys = redisClient.GetAllItemsFromSortedSet(setId);

            serverEvents.NotifyChannel(longOperationStatus.TenantId + ":" + longOperationStatus.ProcessKey.Split('!')[0], new LongOperationStatusCount {
                Tenant = keys.Count, User = keys.Count(x => x.StartsWith(longOperationStatus.UserId))
            });
        }