You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve logging and memory use in user import process
Enhance logging to clearly distinguish between new and existing users during import and metadata enrichment. Add null checks before clearing LicenseLookups to prevent exceptions. Only include LicenseLookups when tenant SKUs are unavailable to reduce memory usage and avoid OOM errors. Refactor existing user update logic for better error handling and reporting. Improve final summary logs to show counts of inserted and updated users.
_telemetry.LogInformation($"User import - Phase 2: Starting metadata enrichment for {usersToInsert.Count.ToString("N0")} new users (existing users will be updated separately)...");
_telemetry.LogInformation($"{DateTime.Now.ToShortTimeString()} User import - complete. Inserted {insertedDbUsers.Count.ToString("N0")} new users, updated metadata for {existingUsersUpdated.ToString("N0")} existing users (from {allActiveGraphUsers.Count.ToString("N0")} Graph users)");
274
+
254
275
// Final cleanup
255
276
dbUsersByUpn.Clear();
256
277
dbUsersByAadId.Clear();
257
278
allActiveGraphUsers.Clear();
258
279
allProcessedDbUsers.Clear();
259
-
260
-
_telemetry.LogInformation($"{DateTime.Now.ToShortTimeString()} User import - inserted {insertedDbUsers.Count.ToString("N0")} new users and updated {notInsertedUpns.Count.ToString("N0")} from Graph API");
0 commit comments