Skip to content

Commit

Permalink
Update project repo size after any Send/Receive
Browse files Browse the repository at this point in the history
  • Loading branch information
rmunn committed Nov 11, 2024
1 parent f853548 commit bfa8683
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/LexBoxApi/Services/ProjectService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public async Task ResetProject(ResetProjectByAdminInput input)
var rowsAffected = await dbContext.Projects.Where(p => p.Code == input.Code && p.ResetStatus == ResetStatus.None)
.ExecuteUpdateAsync(u => u
.SetProperty(p => p.ResetStatus, ResetStatus.InProgress)
.SetProperty(p => p.RepoSizeInKb, 0)
.SetProperty(p => p.LastCommit, null as DateTimeOffset?));
if (rowsAffected == 0) throw new NotFoundException($"project {input.Code} not ready for reset, either already reset or not found", nameof(Project));
await ResetLexEntryCount(input.Code);
Expand Down Expand Up @@ -239,6 +240,7 @@ public async Task UpdateProjectMetadata(Project project)
}

project.LastCommit = await hgService.GetLastCommitTimeFromHg(project.Code);
project.RepoSizeInKb = await hgService.GetRepoSizeInKb(project.Code);
// Caller is responsible for caling dbContext.SaveChangesAsync()
}

Expand Down

0 comments on commit bfa8683

Please sign in to comment.