fix(worker): broadcast TaskUpdated after online-inbox import
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using ClaudeDo.Data;
|
||||
using ClaudeDo.Data.Models;
|
||||
using ClaudeDo.Data.Repositories;
|
||||
using ClaudeDo.Worker.Hub;
|
||||
using ClaudeDo.Worker.Online.Interfaces;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
@@ -15,19 +16,22 @@ public sealed class OnlineSyncService : BackgroundService
|
||||
private readonly IOnlineAuthProvider _auth;
|
||||
private readonly OnlineInboxConfig _config;
|
||||
private readonly ILogger<OnlineSyncService> _logger;
|
||||
private readonly HubBroadcaster _broadcaster;
|
||||
|
||||
public OnlineSyncService(
|
||||
IDbContextFactory<ClaudeDoDbContext> dbFactory,
|
||||
IOnlineInboxApi api,
|
||||
IOnlineAuthProvider auth,
|
||||
OnlineInboxConfig config,
|
||||
ILogger<OnlineSyncService> logger)
|
||||
ILogger<OnlineSyncService> logger,
|
||||
HubBroadcaster broadcaster)
|
||||
{
|
||||
_dbFactory = dbFactory;
|
||||
_api = api;
|
||||
_auth = auth;
|
||||
_config = config;
|
||||
_logger = logger;
|
||||
_broadcaster = broadcaster;
|
||||
}
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
@@ -129,6 +133,8 @@ public sealed class OnlineSyncService : BackgroundService
|
||||
CommitType = CommitTypeRegistry.DefaultType,
|
||||
};
|
||||
await tasks.AddAsync(entity, ct);
|
||||
// Without this the imported task only shows up after a manual reload.
|
||||
await _broadcaster.TaskUpdated(entity.Id);
|
||||
await _api.MarkImportedAsync(remote.Id, ct);
|
||||
|
||||
_logger.LogInformation("OnlineSyncService: imported task {Id} ('{Title}')", remote.Id, remote.Title);
|
||||
|
||||
Reference in New Issue
Block a user