diff --git a/tools/blobstorage-backupdata/BackupData.csproj b/tools/blobstorage-backupdata/BackupData.csproj index f43850e..a797be7 100644 --- a/tools/blobstorage-backupdata/BackupData.csproj +++ b/tools/blobstorage-backupdata/BackupData.csproj @@ -2,15 +2,16 @@ Exe - net7.0 + net8.0 enable enable BackupData.Program - + + diff --git a/tools/blobstorage-backupdata/BackupJob.cs b/tools/blobstorage-backupdata/BackupJob.cs index 5905c10..66e4599 100644 --- a/tools/blobstorage-backupdata/BackupJob.cs +++ b/tools/blobstorage-backupdata/BackupJob.cs @@ -21,7 +21,7 @@ internal sealed class BackupJob private static readonly object LockObject = new(); private static int counter; private const string DateTimeFormat = "yyyy-MM-dd-HH"; - private const int BatchSize = 10000; + private const int BatchSize = 1000; private const string UpdatedFieldName = "_meta.updated"; private const string MetaFieldName = "_meta"; diff --git a/tools/blobstorage-backupdata/Dockerfile b/tools/blobstorage-backupdata/Dockerfile index f058531..b7666f2 100644 --- a/tools/blobstorage-backupdata/Dockerfile +++ b/tools/blobstorage-backupdata/Dockerfile @@ -1,11 +1,11 @@ # Use the official image as a parent image -FROM mcr.microsoft.com/dotnet/runtime:7.0-alpine AS base +FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine AS base LABEL org.opencontainers.image.source="https://github.com/clearlydefined/operations" LABEL org.opencontainers.image.description="ClearlyDefined publish changes job" WORKDIR /app # Use the SDK image to build the app -FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build WORKDIR /src COPY ["BackupData.csproj", "BackupData/"] RUN dotnet restore "BackupData/BackupData.csproj" diff --git a/tools/blobstorage-backupdata/Program.cs b/tools/blobstorage-backupdata/Program.cs index af9ae89..4271cdf 100644 --- a/tools/blobstorage-backupdata/Program.cs +++ b/tools/blobstorage-backupdata/Program.cs @@ -7,25 +7,19 @@ internal sealed class Program { - internal static void Main() + internal static async Task Main() { + DotNetEnv.Env.Load(); string? useJsonLoggingEnvVar = Environment.GetEnvironmentVariable("USE_JSON_LOGGING"); _ = bool.TryParse(useJsonLoggingEnvVar, out bool useJsonLogging); using ILoggerFactory loggerFactory = CustomLoggerFactory.Create(useJsonLogging); ILogger logger = loggerFactory.CreateLogger(nameof(Program)); logger.LogInformation("Backup job started."); - var backupJob = CreateBackupJob(loggerFactory); try { - backupJob.ProcessJob().Wait(); - } - catch (AggregateException ae) - { - foreach (var e in ae.InnerExceptions) - { - logger.LogError(e, "Backup job failed."); - } + var backupJob = CreateBackupJob(loggerFactory); + await backupJob.ProcessJob(); } catch (Exception e) {