Esempio n. 1
0
 // Token: 0x06000591 RID: 1425 RVA: 0x00021220 File Offset: 0x0001F420
 private static void ProcessForADCleanup(IConfigurationSession scopedSession, DeviceClassCache.DeviceClassDataSet localDataSet, DeviceClassCache.DeviceClassDataSet dataSetFromAD, ref int totalADWriteCount, ref int perOrgDeleteCount)
 {
     foreach (DeviceClassCache.DeviceClassData deviceClassData in dataSetFromAD)
     {
         if (totalADWriteCount >= GlobalSettings.DeviceClassCacheMaxADUploadCount)
         {
             AirSyncDiagnostics.TraceDebug <int>(ExTraceGlobals.RequestsTracer, null, "3. Stop updating AD because the cap is reached: adUpdateCount={0}", totalADWriteCount);
             break;
         }
         if (localDataSet.Contains(deviceClassData))
         {
             if ((ExDateTime.UtcNow - deviceClassData.LastUpdateTime).Days >= TimeSpan.FromDays((double)GlobalSettings.DeviceClassCacheADCleanupInterval).Days)
             {
                 AirSyncDiagnostics.TraceDebug <ExDateTime, int>(ExTraceGlobals.RequestsTracer, null, "Update or Create DeviceClass in AD. LastUpdateTime :{0}. adUpdateCount: {1}", deviceClassData.LastUpdateTime, totalADWriteCount);
                 DeviceClassCache.CreateOrUpdateActiveSyncDeviceClass(scopedSession, deviceClassData, localDataSet.OrganizationId);
                 totalADWriteCount++;
             }
         }
         else if ((ExDateTime.UtcNow - deviceClassData.LastUpdateTime).Days > TimeSpan.FromDays((double)GlobalSettings.DeviceClassCacheADCleanupInterval).Days * 2)
         {
             AirSyncDiagnostics.TraceDebug <ExDateTime, int>(ExTraceGlobals.RequestsTracer, null, "Delete DeviceClass in AD. LastUpdateTime :{0}, adUpdateCount: {1} ", deviceClassData.LastUpdateTime, totalADWriteCount);
             DeviceClassCache.DeleteActiveSyncDeviceClass(scopedSession, deviceClassData, localDataSet.OrganizationId);
             perOrgDeleteCount++;
             totalADWriteCount++;
         }
     }
 }
Esempio n. 2
0
        // Token: 0x06000590 RID: 1424 RVA: 0x000210DC File Offset: 0x0001F2DC
        private static void ProcessForADAdds(IConfigurationSession scopedSession, DeviceClassCache.DeviceClassDataSet localDataSet, DeviceClassCache.DeviceClassDataSet dataSetFromAD, ref int totalADWriteCount, int perOrgDeleteCount)
        {
            int num = 0;

            foreach (DeviceClassCache.DeviceClassData deviceClassData in localDataSet)
            {
                if (totalADWriteCount >= GlobalSettings.DeviceClassCacheMaxADUploadCount)
                {
                    AirSyncDiagnostics.TraceDebug <int>(ExTraceGlobals.RequestsTracer, null, "2. Stop updating AD because the cap is reached: adUpdateCount={0}", totalADWriteCount);
                    break;
                }
                if (!dataSetFromAD.Contains(deviceClassData))
                {
                    if (dataSetFromAD.Count + num - perOrgDeleteCount >= GlobalSettings.DeviceClassPerOrgMaxADCount)
                    {
                        AirSyncDiagnostics.TraceDebug <int, int>(ExTraceGlobals.RequestsTracer, null, "Stop adding new device class node to AD because the cap is reached: dataSetFromAD.Count={0}, DeviceClassPerOrgMaxADCount={1}", dataSetFromAD.Count, GlobalSettings.DeviceClassPerOrgMaxADCount);
                        break;
                    }
                    if (dataSetFromAD.Count + num >= DeviceClassCache.ADCapWarningThreshold)
                    {
                        AirSyncDiagnostics.TraceDebug <int, int>(ExTraceGlobals.RequestsTracer, null, "Still adding new device class node to AD but the cap is close to be reached: dataSetFromAD.Count={0}, DeviceClassPerOrgMaxADCount={1}", dataSetFromAD.Count, DeviceClassCache.ADCapWarningThreshold);
                        AirSyncDiagnostics.LogPeriodicEvent(AirSyncEventLogConstants.Tuple_TooManyDeviceClassNodes, localDataSet.OrganizationId.ToString(), new string[]
                        {
                            dataSetFromAD.Count.ToString(),
                            localDataSet.OrganizationId.ToString(),
                            GlobalSettings.DeviceClassPerOrgMaxADCount.ToString()
                        });
                    }
                    DeviceClassCache.CreateOrUpdateActiveSyncDeviceClass(scopedSession, deviceClassData, localDataSet.OrganizationId);
                    num++;
                    totalADWriteCount++;
                }
            }
        }