-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add merge status API to fw-headless #1294
Conversation
Projects that exist but have never been synced are ready to sync.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is really elegant 👨💼 😎
There is something significant missing from the issue though:
This may include "running", "NA", "n changes pending"
I guess if it's not currently syncing, then you somehow calculate how many crdt changes/commits haven't been synced yet (i.e. were added since the last sync). I'm not sure how easy it would be to get the number of hg commits since the last sync, but I'm not sure if @hahn-kev wants that. It would be cool 😆.
It just serves to encapsulate a Dispose() method that does a single thing, and the Defer.Action() method is perfectly adequate for that.
Next we need to figure out what to do if CurrentProjectService can't find the project.
@hahn-kev - Please look at the changes from commit 2649b68, particularly my "This cannot be right, can it?" comment in the changes I just pushed to GetMergeStatus. What's the right approach to opening the CRDT database at that point? I've gotten completely lost in the code again, and I'm pretty sure I need to do something with the ProjectContext.Project object but I have no idea what that something is. |
Since we don't want to succeed if someone has created a directory with the name we're looking for, File.Exists is a better approach here.
Rebasing into develop pulled in a change that LfClassicMiniLcmApi didn't yet implement. Since LF Classic doesn't handle complex forms, the implementation is dead simple: just return null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great, I think it's almost done, I think some things could be named better to clarify what they represent
It is now called SyncJobStatusService, to better distinguish what it does vs. what the ProjectSyncStatus represents. The job status only checks whether there's an active sync job running, while the project sync status will also check how many commits are on the server waiting to be synced. (If a sync is running right now, then the answer is 0 and we can return without hitting the database).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good nice work Robin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least the small open todo's should still be addressed.
But, the functionality and architecture look good to me 👏
// TODO: Bikeshed this name | ||
public record ProjectSyncStatus( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's perfect 👌
// TODO: Bikeshed this name | |
public record ProjectSyncStatus( | |
public record ProjectSyncStatus( |
@@ -36,6 +41,13 @@ | |||
await next(); | |||
}); | |||
|
|||
// Load project ID from request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Or just delete it. But, I believe the comment is inaccurate/out-of-date
// Load project ID from request | |
// Scope services to the relevant project |
@@ -73,6 +87,9 @@ static async Task<Results<Ok<SyncResult>, NotFound, ProblemHttpResult>> ExecuteM | |||
return TypedResults.Ok(new SyncResult(0, 0)); | |||
} | |||
|
|||
syncStatusService.StartSyncing(projectId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 It would be pretty easy to put the number of changes that are being synced in the sync status, so that we can provide that bonus status info during a sync as well.
Fix #1244.
Creates a new GET
/api/crdt-sync-status
endpoint.Currently this returns 404 if the project ID does not match any project in the lexbox database. For all other projects, this returns ReadyToSync unless a CRDT sync is currently in progress, in which case it returns Syncing.