diff --git a/sources/Google.Solutions.LicenseTracker/Services/InstanceHistoryService.cs b/sources/Google.Solutions.LicenseTracker/Services/InstanceHistoryService.cs index 108f17c..67b4ae5 100644 --- a/sources/Google.Solutions.LicenseTracker/Services/InstanceHistoryService.cs +++ b/sources/Google.Solutions.LicenseTracker/Services/InstanceHistoryService.cs @@ -149,6 +149,26 @@ await instances.ConfigureAwait(false), await nodes.ConfigureAwait(false), await disks.ConfigureAwait(false), projectId); + + // + // Query logs to replay history. + // + // NB. We could query mutliple projects at once, but the API + // quickly becomes unreliable (read: throws random 500 errors) + // when doing so. Therefore, we're conservative and only query + // one project at a time. + // + await this.auditLogAdapter + .ProcessInstanceEventsAsync( + new[] { projectId }, + builder.StartDate, + builder, + cancellationToken) + .ConfigureAwait(false); + + this.logger.LogInformation( + "Finished analyzing placement history for project {project}...", + projectId); } catch (ResourceAccessDeniedException e) { @@ -157,26 +177,6 @@ await disks.ConfigureAwait(false), projectId, e.FullMessage()); } - - // - // Query logs to replay history. - // - // NB. We could query mutliple projects at once, but the API - // quickly becomes unreliable (read: throws random 500 errors) - // when doing so. Therefore, we're conservative and only query - // one project at a time. - // - await this.auditLogAdapter - .ProcessInstanceEventsAsync( - new[] { projectId }, - builder.StartDate, - builder, - cancellationToken) - .ConfigureAwait(false); - - this.logger.LogInformation( - "Finished analyzing placement history for project {project}...", - projectId); } return builder.Build();