diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupProcessor.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupProcessor.cs index 5b6229f51..4dee46268 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupProcessor.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/BackupProcessor.cs @@ -114,13 +114,11 @@ namespace Squidex.Domain.Apps.Entities.Backup Handlers = backupHandlerFactory.CreateMany() }; - log.LogInformation("Starting new backup with backup id '{backupId}'.", run.Job.Id); + log.LogInformation("Starting new backup with backup id '{backupId}' for app {appId}.", run.Job.Id, appId); state.Value.Jobs.Insert(0, run.Job); try { - await state.WriteAsync(run.CancellationToken); - await ProcessAsync(run, run.CancellationToken); } finally @@ -137,6 +135,8 @@ namespace Squidex.Domain.Apps.Entities.Backup { try { + await state.WriteAsync(run.CancellationToken); + await using (var stream = backupArchiveLocation.OpenStream(run.Job.Id)) { using (var writer = await backupArchiveLocation.OpenWriterAsync(stream, ct)) @@ -191,10 +191,6 @@ namespace Squidex.Domain.Apps.Entities.Backup await SetStatusAsync(run, JobStatus.Completed); } - catch (OperationCanceledException) - { - await RemoveAsync(run.Job); - } catch (Exception ex) { await SetStatusAsync(run, JobStatus.Failed); diff --git a/backend/src/Squidex.Domain.Apps.Entities/Backup/RestoreProcessor.cs b/backend/src/Squidex.Domain.Apps.Entities/Backup/RestoreProcessor.cs index 5308f35f9..3b475b716 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Backup/RestoreProcessor.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Backup/RestoreProcessor.cs @@ -113,8 +113,6 @@ namespace Squidex.Domain.Apps.Entities.Backup state.Value.Job = run.Job; try { - await state.WriteAsync(run.CancellationToken); - await ProcessAsync(run, run.CancellationToken); } finally @@ -133,6 +131,8 @@ namespace Squidex.Domain.Apps.Entities.Backup { try { + await state.WriteAsync(run.CancellationToken); + await LogAsync(run, "Started. The restore process has the following steps:"); await LogAsync(run, " * Download backup"); await LogAsync(run, " * Restore events and attachments."); diff --git a/backend/src/Squidex/Config/Messaging/MessagingServices.cs b/backend/src/Squidex/Config/Messaging/MessagingServices.cs index 80334d39c..d8ee4b0ce 100644 --- a/backend/src/Squidex/Config/Messaging/MessagingServices.cs +++ b/backend/src/Squidex/Config/Messaging/MessagingServices.cs @@ -91,17 +91,19 @@ namespace Squidex.Config.Messaging options.Routing.AddFallback(channelFallback); }); - services.AddMessaging(channelFallback, isWorker, options => - { - options.Scheduler = InlineScheduler.Instance; - }); - services.AddMessaging(channelBackupStart, isWorker, options => { + options.Timeout = TimeSpan.FromHours(4); options.Scheduler = new ParallelScheduler(4); }); services.AddMessaging(channelBackupRestore, isWorker, options => + { + options.Timeout = TimeSpan.FromHours(24); + options.Scheduler = InlineScheduler.Instance; + }); + + services.AddMessaging(channelFallback, isWorker, options => { options.Scheduler = InlineScheduler.Instance; }); diff --git a/frontend/src/app/framework/angular/pipes/date-time.pipes.spec.ts b/frontend/src/app/framework/angular/pipes/date-time.pipes.spec.ts index 5d5721ad8..e4133d093 100644 --- a/frontend/src/app/framework/angular/pipes/date-time.pipes.spec.ts +++ b/frontend/src/app/framework/angular/pipes/date-time.pipes.spec.ts @@ -113,7 +113,7 @@ describe('FromNowPipe', () => { const pipe = new FromNowPipe(); const actual = pipe.transform(DateTime.now().addMinutes(-4)); - const expected = '4 minutes'; + const expected = '4 minutes ago'; expect(actual).toBe(expected); }); diff --git a/frontend/src/app/framework/utils/date-time.spec.ts b/frontend/src/app/framework/utils/date-time.spec.ts index a135a4db9..dfabb261b 100644 --- a/frontend/src/app/framework/utils/date-time.spec.ts +++ b/frontend/src/app/framework/utils/date-time.spec.ts @@ -120,7 +120,7 @@ describe('DateTime', () => { it('should print to from now string', () => { const value = DateTime.now().addMinutes(-4); - const expected = '4 minutes'; + const expected = '4 minutes ago'; expect(value.toFromNow()).toBe(expected); }); @@ -231,7 +231,7 @@ describe('DateTime', () => { it('should format to from now string', () => { const value = DateTime.now().addMinutes(-4); - const expected = '4 minuten'; + const expected = '4 minuten geleden'; expect(value.toFromNow()).toBe(expected); }); @@ -262,7 +262,7 @@ describe('DateTime', () => { it('should format to from now string', () => { const value = DateTime.now().addMinutes(-4); - const expected = '4 minuti'; + const expected = '4 minuti fa'; expect(value.toFromNow()).toBe(expected); }); diff --git a/frontend/src/app/framework/utils/date-time.ts b/frontend/src/app/framework/utils/date-time.ts index a85d6f1d3..0b642e8b9 100644 --- a/frontend/src/app/framework/utils/date-time.ts +++ b/frontend/src/app/framework/utils/date-time.ts @@ -193,7 +193,7 @@ export class DateTime { } public toFromNow(): string { - return formatDistanceToNow(this.value, { locale: DateHelper.getFnsLocale() }); + return formatDistanceToNow(this.value, { locale: DateHelper.getFnsLocale(), addSuffix: true }); } public toISOString(withoutMilliseconds = true): string {