#262 skeleton for the method to batch convert museum images to webp
This commit is contained in:
parent
e546293739
commit
5da8dda866
@ -9933,6 +9933,15 @@
|
||||
<summary>
|
||||
IArtifactService implementation
|
||||
</summary>
|
||||
<summary>
|
||||
IArtifactService implementation
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.ArtifactService.StartConvertingOriginalImagesToWebp">
|
||||
<summary>
|
||||
convert original images to webp
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.ArtifactService.StartFillingGanjoorLinkOriginalSources">
|
||||
<summary>
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using RMuseum.DbContext;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
using RSecurityBackend.Services.Implementation;
|
||||
using System;
|
||||
|
||||
namespace RMuseum.Services.Implementation
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// IArtifactService implementation
|
||||
/// </summary>
|
||||
public partial class ArtifactService : IArtifactService
|
||||
{
|
||||
/// <summary>
|
||||
/// convert original images to webp
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public RServiceResult<bool> StartConvertingOriginalImagesToWebp()
|
||||
{
|
||||
_backgroundTaskQueue.QueueBackgroundWorkItem
|
||||
(
|
||||
async token =>
|
||||
{
|
||||
using (RMuseumDbContext context = new RMuseumDbContext(new DbContextOptions<RMuseumDbContext>())) //this is long running job, so _context might be already been freed/collected by GC
|
||||
{
|
||||
LongRunningJobProgressServiceEF jobProgressServiceEF = new LongRunningJobProgressServiceEF(context);
|
||||
var job = (await jobProgressServiceEF.NewJob($"Converting Original Images To Webp", "Query data")).Result;
|
||||
try
|
||||
{
|
||||
await jobProgressServiceEF.UpdateJob(job.Id, 100, "", true);
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
await jobProgressServiceEF.UpdateJob(job.Id, 100, "", false, exp.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return new RServiceResult<bool>(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user