Skip to content

Commit

Permalink
set project OriginDomain to null if the initial sync fails
Browse files Browse the repository at this point in the history
  • Loading branch information
hahn-kev committed Nov 19, 2024
1 parent d5da247 commit 4a4e72d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/FwLite/LcmCrdt/CurrentProjectService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private void RemoveProjectDataCache()
memoryCache.Remove(CacheKey(Project));
}

public async Task SetProjectSyncOrigin(Uri domain, Guid? id)
public async Task SetProjectSyncOrigin(Uri? domain, Guid? id)
{
var originDomain = ProjectData.GetOriginDomain(domain);
if (id is null)
Expand Down
10 changes: 9 additions & 1 deletion backend/FwLite/LocalWebApp/Routes/ProjectRoutes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,15 @@ public static IEndpointConventionBuilder MapProjectRoutes(this WebApplication ap
{
var server = options.Value.GetServerByAuthority(serverAuthority);
await currentProjectService.SetProjectSyncOrigin(server.Authority, lexboxProjectId);
await syncService.ExecuteSync();
try
{
await syncService.ExecuteSync();
}
catch
{
await currentProjectService.SetProjectSyncOrigin(null, null);
throw;
}
lexboxProjectService.InvalidateProjectsCache(server);
return TypedResults.Ok();
});
Expand Down

0 comments on commit 4a4e72d

Please sign in to comment.